michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: */ michael@0: michael@0: [JSImplementation="@mozilla.org/settingsLock;1", michael@0: Pref="dom.mozSettings.enabled"] michael@0: interface SettingsLock { michael@0: // Whether this lock is invalid michael@0: readonly attribute boolean closed; michael@0: michael@0: // Contains a JSON object with name/value pairs to be set. michael@0: DOMRequest set(object settings); michael@0: michael@0: // Result contains the value of the setting. michael@0: DOMRequest get(DOMString name); michael@0: michael@0: DOMRequest clear(); michael@0: }; michael@0: michael@0: dictionary SettingChange { michael@0: DOMString settingName; michael@0: DOMString settingValue; michael@0: }; michael@0: michael@0: callback SettingChangeCallback = void (SettingChange setting); michael@0: michael@0: [JSImplementation="@mozilla.org/settingsManager;1", michael@0: NavigatorProperty="mozSettings", michael@0: Pref="dom.mozSettings.enabled"] michael@0: interface SettingsManager : EventTarget { michael@0: SettingsLock createLock(); michael@0: michael@0: void addObserver(DOMString name, SettingChangeCallback callback); michael@0: void removeObserver(DOMString name, SettingChangeCallback callback); michael@0: michael@0: attribute EventHandler onsettingchange; michael@0: };