Labs/Jetpack/JEP/11: Difference between revisions

propose API for setting/removing multiple values
(propose API for getting multiple values)
(propose API for setting/removing multiple values)
Line 55: Line 55:
''Arguments''
''Arguments''


<code>key</code>: A string uniquely identifying the data to be placed in persistent storage.  If <code>key</code> is not a string, an exception is thrown.
<code>key</code>: A string uniquely identifying the data to be placed into persistent storage, or an object whose properties and their values identify the data to place into persistent storage.  If <code>key</code> is not a string or an object, an exception is thrown.


<code>value</code>: A JS primitive or JSON-able JS object that represents the data to be stored in persistent storage.  If some other data with the given <code>key</code> is already being stored, it is overwritten by <code>value</code>. If <code>value</code> is not a JS primitive or a JSON-able JS object, an exception is thrown.
<code>value</code>: A JS primitive or JSON-able JS object that represents the data to be stored in persistent storage.  If <code>key</code> is an object, this argument is ignored. If some other data with the given <code>key</code> is already being stored, it is overwritten by <code>value</code>. If <code>value</code> is not a JS primitive or a JSON-able JS object, an exception is thrown.


<code>callback</code>: A callback. <code>onResult</code> and <code>onError</code> will be passed <code>key</code> and <code>value</code>.
<code>callback</code>: A callback. <code>onResult</code> and <code>onError</code> will be passed <code>key</code> and <code>value</code>.
Line 95: Line 95:
''Arguments''
''Arguments''


<code>key</code>: The string uniquely identifying the data to be removed from persistent storage.  If <code>key</code> is not a string, an exception is thrown.
<code>key</code>: The string uniquely identifying the data to be removed from persistent storage, or an array of such strings.  If <code>key</code> is not a string or an array, an exception is thrown.


<code>callback</code>: A callback.  <code>onResult</code> and <code>onError</code> will be passed only <code>key</code>.
<code>callback</code>: A callback.  <code>onResult</code> and <code>onError</code> will be passed only <code>key</code>.
canmove, Confirmed users
2,056

edits