Labs/Jetpack/JEP/11: Difference between revisions

Jump to navigation Jump to search
→‎Enumerating Specific Values: Added warning about check for null and strict equality
(→‎JEP 11 - Simple Persistent Storage: Updated authorship. Drew's done most of the work.)
(→‎Enumerating Specific Values: Added warning about check for null and strict equality)
Line 311: Line 311:
** <code>onResult(value)</code> is called for each key given in <code>keyArray</code>.  If a given key does not exist in the store, <code>value</code> will be <code>undefined</code>.  Values are enumerated in the same order that their keys are given in <code>keyArray</code>.
** <code>onResult(value)</code> is called for each key given in <code>keyArray</code>.  If a given key does not exist in the store, <code>value</code> will be <code>undefined</code>.  Values are enumerated in the same order that their keys are given in <code>keyArray</code>.
* <code>onResult(null)</code>
* <code>onResult(null)</code>
** When all values are exhausted, <code>onResult(null)</code> is called to signal that enumeration is complete.
** When all values are exhausted, <code>onResult(null)</code> is called to signal that enumeration is complete.  Because <code>value</code> will be undefined when a given key does not exist, <code>onResult</code> should always use strict equality (<code>===</code> instead of <code>==</code> or <code>!value</code>) when checking for the <code>null</code> signal so that an <code>undefined</code> value is not mistaken for it.
* <code>onError(errorMessage, keyArray)</code>
* <code>onError(errorMessage, keyArray)</code>


Confirmed users
764

edits

Navigation menu