Changes

Jump to: navigation, search

WebAPI/SettingsAPI

409 bytes added, 03:01, 18 February 2012
Proposed API
There is a readonly mozSettings attribute in ''window.navigator'' that would return an object implementing the ''SettingsManager'' interface.
interface SettingsManager : EventTarget { // SettingsRequestThe implementation keeps a queue of active locks.result contains When a lock is created it's placed at the new value end of the settingqueue. DOMRequest Calls to get/set(any settings); // SettingsRequestplaces a request against the lock on which it's called. Requests run asynchronously and in the order they are placed against a lock.result contains When the value of last request for a lock is run, and we've fired the setting. DOMRequest get(DOMString name); success// SettingsRequesterror event against it, the lock is removed from the queue and we start processing the next lock.result contains JSON object with name/value pairs. DOMRequest get(DOMString[] names); attribute Function? onchange; }
interface SettingsManager : EventTarget { SettingsLock getLock(); attribute Function? onchange; } interface SettingsLock { // Contains a JSON object with name/value pairs to be set. DOMRequest set(any settings); // result contains the value of the setting. DOMRequest get(DOMString name); // result contains JSON object with name/value pairs. DOMRequest get(DOMString[] names); }  /* Same as used in other specs. */ interface DOMRequest { readonly attribute DOMString readyState; // "processing" or "done" readonly attribute DOMError? error; attribute EventListener onsuccess; attribute EventListener onerror; attribute readonly any? result; };
[Constructor(DOMString type, optional SettingsEventInit settingsEventInitDict)] interface SettingsEvent : Event { readonly attribute DOMString settingName; readonly attribute any settingValue; };
dictionary SettingsEventInit : EventInit { DOMString settingName; any settingValue; }
''SettingsEvent'' is used for the followings events:
Confirm
716
edits

Navigation menu