Search completed in 2.33 seconds.
256 results for "Iterator":
Your results are loading. Please wait...
Iterators and generators - JavaScript
iterators and generators bring the concept of iteration directly into the core language and provide a mechanism for customizing the behavior of for...of loops.
... for details, see also: iteration_protocols for...of function* and generator yield and yield* iterators in javascript an iterator is an object which defines a sequence and potentially a return value upon its termination.
... specifically, an iterator is any object which implements the iterator protocol by having a next() method that returns an object with two properties: value the next value in the iteration sequence.
...And 18 more matches
NodeIterator - Web APIs
the nodeiterator interface represents an iterator over the members of a list of the nodes in a subtree of the dom.
... syntax a nodeiterator can be created using the document.createnodeiterator() method, as follows: const nodeiterator = document.createnodeiterator(root, whattoshow, filter); properties this interface doesn't inherit any property.
... nodeiterator.root read only returns a node representing the root node as specified when the nodeiterator was created.
...And 14 more matches
Iterator - Archive of obsolete content
the iterator function is a spidermonkey-specific feature, and will be removed at some point.
... for future-facing usages, consider using for..of loops and the iterator protocol.
... the iterator function returns an object which implements legacy iterator protocol and iterates over enumerable properties of an object.
...And 9 more matches
Symbol.asyncIterator - JavaScript
the symbol.asynciterator well-known symbol specifies the default asynciterator for an object.
... description the symbol.asynciterator symbol is a builtin symbol that is used to access an object's @@asynciterator method.
... in order for an object to be async iterable, it must have a symbol.asynciterator key.
...And 5 more matches
JS_ContextIterator
syntax jscontext * js_contextiterator(jsruntime *rt, jscontext **iterp); name type description rt jsruntime * the runtime to walk.
... description js_contextiterator steps through the set of contexts associated with the runtime rt.
... each call to js_contextiterator returns the next context in the cycle.
...And 4 more matches
NodeIterator.whatToShow - Web APIs
the nodeiterator.whattoshow read-only property represents an unsigned integer representing a bitmask signifying what types of nodes should be returned by the nodeiterator.
... syntax var nodetypes = nodeiterator.whattoshow; the values that can be combined to form the bitmask are: constant numerical value description nodefilter.show_all -1 (that is the max value of unsigned long) shows all nodes.
...this is meaningful only when creating a nodeiterator or treewalker with an attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal.
...And 4 more matches
Array.prototype[@@iterator]() - JavaScript
the @@iterator method is part of the iterable protocol, that defines how to synchronously iterate over a sequence of values.
... the initial value of the @@iterator property is the same function object as the initial value of the values() property.
... syntax arr[symbol.iterator]() return value the initial value given by the values() iterator.
...And 4 more matches
XPathResult.invalidIteratorState - Web APIs
the read-only invaliditeratorstate property of the xpathresult interface signifies that the iterator has become invalid.
... it is true if xpathresult.resulttype is unordered_node_iterator_type or ordered_node_iterator_type and the document has been modified since this result was returned.
... syntax var iteratorstate = result.invaliditeratorstate; return value a boolean value indicating whether the iterator has become invalid.
...And 3 more matches
The legacy Iterator protocol - JavaScript
the legacy iterator protocol was a spidermonkey-specific feature, which is removed in firefox 58+.
... for future-facing usages, consider using for..of loops and the iterator protocol.
... the deprecated firefox-only iterator protocol firefox, prior to version 26 implemented another iterator protocol that is similar to the standard es2015 iterator protocol.
...And 3 more matches
JSIteratorOp
this article covers features introduced in spidermonkey 1.8 callback for creating iterators.
... syntax typedef jsobject * (*jsiteratorop)(jscontext *cx, jsobject *obj, jsbool keysonly); name type description cx jscontext * pointer to the js context in which the iterator creation should take place.
... keysonly jsbool if true, the iterator should yield keys only, not [key, value] pairs.
...And 2 more matches
Document.createNodeIterator() - Web APIs
returns a new nodeiterator object.
... syntax const nodeiterator = document.createnodeiterator(root[, whattoshow[, filter]]); values root the root node at which to begin the nodeiterator's traversal.
...this parameter indicated whether or not the children of entity reference nodes were visible to the iterator.
...And 2 more matches
NodeIterator.detach() - Web APIs
the nodeiterator.detach() method is a no-op, kept for backward compatibility only.
... originally, it detached the nodeiterator from the set over which it iterates, releasing any resources used by the set and setting the iterator's state to invalid.
... once this method had been called, calls to other methods on nodeiterator would raise the invalid_state_err exception.
...And 2 more matches
Symbol.iterator - JavaScript
the well-known symbol.iterator symbol specifies the default iterator for an object.
... description whenever an object needs to be iterated (such as at the beginning of a for..of loop), its @@iterator method is called with no arguments, and the returned iterator is used to obtain the values to be iterated.
...the built-in types with a @@iterator method are: array.prototype[@@iterator]() typedarray.prototype[@@iterator]() string.prototype[@@iterator]() map.prototype[@@iterator]() set.prototype[@@iterator]() see also iteration protocols for more information.
...And 2 more matches
JS_NewPropertyIterator
crate an iterator object for use with js_nextproperty.
... syntax jsobject * js_newpropertyiterator(jscontext *cx, js::handle<jsobject*> obj); name type description cx jscontext * the js context in which to enumerate properties.
...note also that while for..in includes properties inherited from prototypes, iterator objects do not.) on success, this returns an iterator object that can be passed to js_nextproperty to fetch the property ids.
...the iterator object created by this function is not a javascript iterator.
NodeIterator.filter - Web APIs
the nodeiterator.filter read-only method returns a nodefilter object, that is an object implement an acceptnode(node) method, used to screen nodes.
... when creating the nodeiterator, the filter object is passed in as the third parameter, and the object method acceptnode(node) is called on every single node to determine whether or not to accept it.
... syntax nodefilter = nodeiterator.filter; example const nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); nodefilter = nodeiterator.filter; specifications specification status comment domthe definition of 'nodeiterator.filter' in that specification.
... document object model (dom) level 2 traversal and range specificationthe definition of 'nodeiterator.filter' in that specification.
NodeIterator.nextNode() - Web APIs
the nodeiterator.nextnode() method returns the next node in the set represented by the nodeiterator and advances the position of the iterator within the set.
... in old browsers, as specified in old versions of the specifications, the method may throws the invalid_state_err domexception if this method is called after the nodeiterator.detach()method.
... syntax node = nodeiterator.nextnode(); example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false // this optional argument is not used any more ); currentnode = nodeiterator.nextnode(); // returns the next node specifications specification status comment domthe definition of 'nodeiterator.nextnode' in that specification.
... document object model (dom) level 2 traversal and range specificationthe definition of 'nodeiterator.nextnode' in that specification.
NodeIterator.previousNode() - Web APIs
the nodeiterator.previousnode() method returns the previous node in the set represented by the nodeiterator and moves the position of the iterator backwards within the set.
... in old browsers, as specified in old versions of the specifications, the method may throws the invalid_state_err domexception if this method is called after the nodeiterator.detach()method.
... syntax node = nodeiterator.previousnode(); example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false // this optional argument is not used any more ); currentnode = nodeiterator.nextnode(); // returns the next node previousnode = nodeiterator.previousnode(); // same result, since we backtracked to the previous node specifications specification status comment domthe definition of 'nodeiterator.previousnode' in that specification.
... document object model (dom) level 2 traversal and range specificationthe definition of 'nodeiterator.previousnode' in that specification.
NodeIterator.expandEntityReferences - Web APIs
the nodeiterator.expandentityreferences read-only property returns a boolean flag indicating whether or not the children of entity reference nodes are visible to the nodeiterator.
...this takes precedence over the value of the nodeiterator.whattoshow method and the associated filter.
... syntax expand = nodeiterator.expandentityreferences; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); expand = nodeiterator.expandentityreferences; specifications specification status comment document object model (dom) level 2 traversal and range specificationthe definition of 'nodeiterator.expandentityreferences' in that specification.
NodeIterator.root - Web APIs
WebAPINodeIteratorroot
the nodeiterator.root read-only property represents the node that is the root of what the nodeiterator traverses.
... syntax root = nodeiterator.root; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); root = nodeiterator.root; // document.body in this case specifications specification status comment domthe definition of 'nodeiterator.root' in that specification.
... document object model (dom) level 2 traversal and range specificationthe definition of 'nodeiterator.root' in that specification.
Map.prototype[@@iterator]() - JavaScript
the initial value of the @@iterator property is the same function object as the initial value of the entries method.
... syntax mymap[symbol.iterator] return value the map iterator function, which is the entries() function by default.
... examples using [@@iterator]() const mymap = new map() mymap.set('0', 'foo') mymap.set(1, 'bar') mymap.set({}, 'baz') const mapiter = mymap[symbol.iterator]() console.log(mapiter.next().value) // ["0", "foo"] console.log(mapiter.next().value) // [1, "bar"] console.log(mapiter.next().value) // [object, "baz"] using [@@iterator]() with for..of const mymap = new map() mymap.set('0', 'foo') mymap.set(1, 'bar') mymap.set({}, 'baz') for (const entry of mymap) { console.log(entry) } // ["0", "foo"] // [1, "bar"] // [{}, "baz"] for (const [key, value] of mymap) { console.log(`${key}: ${value}`) } // 0: foo // 1: bar // [object]: baz specifications specification ecmascript (ecma-262)the definition of 'map.prototype[@@iterator]()' in that specification.
Set.prototype[@@iterator]() - JavaScript
the initial value of the @@iterator property is the same function object as the initial value of the values property.
... syntax myset[symbol.iterator] return value the set iterator function, which is the values() function by default.
... examples using [@@iterator]() const myset = new set(); myset.add('0'); myset.add(1); myset.add({}); const setiter = myset[symbol.iterator](); console.log(setiter.next().value); // "0" console.log(setiter.next().value); // 1 console.log(setiter.next().value); // object using [@@iterator]() with for..of const myset = new set(); myset.add('0'); myset.add(1); myset.add({}); for (const v of myset) { console.log(v); } specifications specification ecmascript (ecma-262)the definition of 'set.prototype[@@iterator]' in that specification.
String.prototype[@@iterator]() - JavaScript
the [@@iterator]() method returns a new iterator object that iterates over the code points of a string value, returning each code point as a string value.
... syntax str[symbol.iterator] return value a new iterator object.
... examples using [@@iterator]() var str = 'a\ud835\udc68'; var striter = str[symbol.iterator](); console.log(striter.next().value); // "a" console.log(striter.next().value); // "\ud835\udc68" using [@@iterator]() with for..of var str = 'a\ud835\udc68b\ud835\udc69c\ud835\udc6a'; for (var v of str) { console.log(v); } // "a" // "\ud835\udc68" // "b" // "\ud835\udc69" // "c" // "\ud835\udc6a" specifications specification ecmascript (ecma-262)the definition of 'string.prototype[@@iterator]()' in that specification.
TypedArray.prototype[@@iterator]() - JavaScript
the initial value of the @@iterator property is the same function object as the initial value of the values property.
... syntax arr[symbol.iterator]() return value the array iterator function, which is the values() function by default.
... examples iteration using for...of loop var arr = new uint8array([10, 20, 30, 40, 50]); // your browser must support for..of loop // and let-scoped variables in for loops for (let n of arr) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr[symbol.iterator](); console.log(earr.next().value); // 10 console.log(earr.next().value); // 20 console.log(earr.next().value); // 30 console.log(earr.next().value); // 40 console.log(earr.next().value); // 50 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype[@@iterator]()' in that specification.
NodeIterator.pointerBeforeReferenceNode - Web APIs
the nodeiterator.pointerbeforereferencenode read-only property returns a boolean flag that indicates whether the nodefilter is anchored before (if this value is true) or after (if this value is false) the anchor node indicated by the nodeiterator.referencenode property.
... syntax flag = nodeiterator.pointerbeforereferencenode; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); flag = nodeiterator.pointerbeforereferencenode; specifications specification status comment domthe definition of 'nodeiterator.pointerbeforereferencenode' in that specification.
NodeIterator.referenceNode - Web APIs
the nodeiterator.referencenode read-only returns the node to which the iterator is anchored; as new nodes are inserted, the iterator remains anchored to the reference node as specified by this property.
... syntax node = nodeiterator.referencenode; example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); node = nodeiterator.referencenode; specifications specification status comment domthe definition of 'nodeiterator.referencenode' in that specification.
arguments[@@iterator]() - JavaScript
the initial value of the @@iterator property is the same function object as the initial value of the array.prototype.values property.
... syntax arguments[symbol.iterator]() examples iteration using for...of loop function f() { // your browser must support for..of loop // and let-scoped variables in for loops for (let letter of arguments) { console.log(letter); } } f('w', 'y', 'k', 'o', 'p'); specifications specification ecmascript (ecma-262)the definition of 'createunmappedargumentsobject' in that specification.
nsIDirectoryIterator
the nsidirectoryiterator interface provides a way to iterate over the entries in a directory.
Index - Web APIs
WebAPIIndex
489 cssunparsedvalue.keys() api, css typed object model api, cssunparsedvalue, constructor, experimental, houdini, method, needsexample, reference, keys() the cssunparsedvalue.keys() method returns a new array iterator object that contains the keys for each index in the array.
... 491 cssunparsedvalue.values() api, css typed object model api, cssunparsedvalue, constructor, experimental, houdini, method, needsexample, reference, values() the cssunparsedvalue.values() method returns a new array iterator object that contains the values for each index in the cssunparsedvalue object.
... 770 domtokenlist.entries() dom, domtokenlist, iterable, method, reference, web the domtokenlist.entries() method returns an iterator allowing you to go through all key/value pairs contained in this object.
...And 35 more matches
Iteration protocols - JavaScript
there are two protocols: the iterable protocol and the iterator protocol.
... in order to be iterable, an object must implement the @@iterator method, meaning that the object (or one of the objects up its prototype chain) must have a property with a @@iterator key which is available via constant symbol.iterator: property value [symbol.iterator] a zero-argument function that returns an object, conforming to the iterator protocol.
... whenever an object needs to be iterated (such as at the beginning of a for...of loop), its @@iterator method is called with no arguments, and the returned iterator is used to obtain the values to be iterated.
...And 22 more matches
Bytecode Descriptions
this instruction is used for object literals like {0: val} and {[id]: val}, and methods like *[symbol.iterator]() {}.
...format: jof_elem, jof_propset, jof_checkstrict enumeration iter stack: val ⇒ iter set up a for-in loop by pushing a propertyiteratorobject over the enumerable properties of val.
...(the spec refers to an "iterator object" with a next method, but notes that it "is never directly accessible" to scripts.
...And 13 more matches
Array.from() - JavaScript
// production steps of ecma-262, edition 6, 22.1.2.1 if (!array.from) { array.from = (function () { var symboliterator; try { symboliterator = symbol.iterator ?
... symbol.iterator : 'symbol(symbol.iterator)'; } catch { symboliterator = 'symbol(symbol.iterator)'; } var tostr = object.prototype.tostring; var iscallable = function (fn) { return ( typeof fn === 'function' || tostr.call(fn) === '[object function]' ); }; var tointeger = function (value) { var number = number(value); if (isnan(number)) return 0; if (number === 0 || !isfinite(number)) return number; return (number > 0 ?
... 1 : -1) * math.floor(math.abs(number)); }; var maxsafeinteger = math.pow(2, 53) - 1; var tolength = function (value) { var len = tointeger(value); return math.min(math.max(len, 0), maxsafeinteger); }; var setgetitemhandler = function setgetitemhandler(isiterator, items) { var iterator = isiterator && items[symboliterator](); return function getitem(k) { return isiterator ?
...And 9 more matches
Introduction to using XPath in JavaScript - XPath
node-set types the xpathresult object allows node-sets to be returned in 3 principal different types: iterators snapshots first nodes iterators when the specified result type in the resulttype parameter is either: unordered_node_iterator_type ordered_node_iterator_type the xpathresult object returned is a node-set of matched nodes which will behave as an iterator, allowing us to access the individual nodes contained by using the iteratenext() method of the xpathresult.
... note however, that if the document is mutated (the document tree is modified) between iterations that will invalidate the iteration and the invaliditeratorstate property of xpathresult is set to true, and a ns_error_dom_invalid_state_err exception is thrown.
... iterator example var iterator = document.evaluate('//phonenumber', documentnode, null, xpathresult.unordered_node_iterator_type, null ); try { var thisnode = iterator.iteratenext(); while (thisnode) { alert( thisnode.textcontent ); thisnode = iterator.iteratenext(); } } catch (e) { alert( 'error: document tree modified during iteration ' + e ); } snapshots when the specified result type in the resulttype parameter is either: unordered_node_snapshot_type ordered_node_snapshot_type the xpathresult object returned is a static node-set of matched nodes, which allows us to access each node through the snapshotitem(itemnumber) method of the xpathresult object, where itemnumber is the index of the node to be retrieved.
...And 7 more matches
Mozilla internal string guide
iterators because mozilla strings are always a single buffer, iteration over the characters in the string is done using raw pointers: /** * find whether there is a tab character in `data` */ bool hastab(const nsastring& data) { const char16_t* cur = data.beginreading(); const char16_t* end = data.endreading(); for (; cur < end; ++cur) { if (char16_t('\t') == *cur) return true; } r...
... note that iterators become invalid after changing the length of a string: /** * replace every tab character in `data` with four spaces.
...the syntax is: prbool findinreadable(const nsastring& pattern, nsastring::const_iterator start, nsastring::const_iterator end, nsstringcomparator& acomparator = nsdefaultstringcomparator()); to use this, start and end should point to the beginning and end of a string that you would like to search.
...And 6 more matches
Index - Archive of obsolete content
641 string quick reference xpcom what: use abstract classes instead of concrete classes when passing strings across function boundaries 642 string rosetta stone findinreadable(const nsastring& pattern, nsastring::const_iterator start, nsastring::const_iterator end, nsstringcomparator& acomparator = nsdefaultstringcomparator()) 643 structure of an installable bundle add-ons, extensions, search plugins, themes, toolkit api, xulrunner xulrunner applications, extensions, and themes all share a common directory structure, and in some cases the same bundle can be used as a standalone xulrunner application...
... 2013 generator comprehensions iterator, javascript, language feature, non-standard, obsolete, reference the generator comprehension syntax was a javascript expression which allowed you to quickly assemble a new generator function based on an existing iterable object.
... 2014 legacy generator function javascript, language feature, legacy iterator, non-standard, obsolete, reference the legacy generator function statement declares legacy generator functions with the specified parameters.
...And 4 more matches
Demo Addon
we make use of fixiterator().
...it lets you iterate over any collection and transforms your collection elements in the given objects, to use fixiterator, you have to import it with cu.import("resource:///modules/iteratorutils.jsm");.
... let data = []; for each (let account in fixiterator(mailservices.accounts.accounts, ci.nsimsgaccount)) { let info = { server: null, type: null, emails: [], name: null, }; let server = account.incomingserver; if (server) { info.server = server.prettyname; info.type = server.type; } for each (let id in fixiterator(account.identities, ci.nsimsgidentity)) { // we're only interested in identities that have a real email.
...And 4 more matches
NodeFilter - Web APIs
a nodefilter interface represents an object used to filter the nodes in a nodeiterator or treewalker.
...it is the user who is expected to write one, tailoring the acceptnode() method to its needs, and using it with some treewalker or nodeiterator objects.
... nodefilter.acceptnode() returns an unsigned short that will be used to tell if a given node must be accepted or not by the nodeiterator or treewalker iteration algorithm.
...And 4 more matches
Array.prototype.values() - JavaScript
the values() method returns a new array iterator object that contains the values for each index in the array.
... syntax arr.values() return value a new array iterator object.
... examples iteration using for...of loop var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); for (let letter of iterator) { console.log(letter); } //"a" "b" "c" "d" "e" array.prototype.values is default implementation of array.prototype[symbol.iterator].
...And 4 more matches
util/array - Archive of obsolete content
fromiterator(iterator) iterates over an iterator and returns the results as an array.
... let { fromiterator } = require('sdk/util/array'); let i = new set(); i.add('otoro'); i.add('unagi'); i.add('keon'); fromiterator(i) // ['otoro', 'unagi', 'keon'] parameters iterator : iterator the iterator object over which to iterate and place results into an array.
... returns array : the iterator's results in an array.
...And 3 more matches
Index
123 jsiteratorop jsapi reference, obsolete, reference, référence(2), spidermonkey the javascript engine calls the jsextendedclass.iteratorobject callback to create an iterator object for a given object.
... the callback should return an iterator object or null if an error or exception occurred on cx.
... 218 js_contextiterator jsapi reference, spidermonkey js_contextiterator steps through the set of contexts associated with the runtime rt.
...And 3 more matches
NodeFilter.acceptNode() - Web APIs
the nodefilter.acceptnode() method returns an unsigned short that will be used to tell if a given node must be accepted or not by the nodeiterator or treewalker iteration algorithm.
...the children of rejected nodes are not visited by the nodeiterator or treewalker object; this value is treated as "skip this node and all its children".
... nodefilter.filter_skip value to be returned by nodefilter.acceptnode() for nodes to be skipped by the nodeiterator or treewalker object.
...And 3 more matches
XPathResult - Web APIs
xpathresult.invaliditeratorstateread only signifies that the iterator has become invalid.
... it is true if resulttype is unordered_node_iterator_type or ordered_node_iterator_type and the document has been modified since this result was returned.
...unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated.
...And 3 more matches
StopIteration - Archive of obsolete content
for future-facing usages, consider using for..of loops and the iterator protocol.
... the stopiteration object was used to tell the end of the iteration in the legacy iterator protocol.
... syntax stopiteration description stopiteration is a part of legacy iterator protocol, and it will be removed at the same time as legacy iterator and legacy generator.
...And 2 more matches
nsIDOMXPathResult
invaliditeratorstate boolean true if the iterator state has become invalid.
... for example, modifying a node invalidates the iterator.
... unordered_node_iterator_type 4 type is a reference to all the nodes matching the expression used in the evaluator.
...And 2 more matches
WebIDL bindings
iterable interfaces have different requirements, based on if they are single or pair value iterators.
... example interface for a single value iterator: interface longiterable { iterable<long>; getter long(unsigned long index); readonly attribute unsigned long length; }; for single value iterator interfaces, we treat the interface as an indexed getter, as required by the spec.
... example interface for a pair value iterator: interface stringandlongiterable { iterable<domstring, long>; }; the bindings for this pair value iterator interface require the following methods be implemented in the c++ object: class stringandlongiterable { public: // returns the number of items in the iterable storage size_t getiterablelength(); // returns key of pair at aindex in iterable storage nsastring& getkeyatindex(uint32_t aindex); // returns value of pair at aindex in iterable storage uint32_t& getvalueatindex(uint32_t aindex); } stringifiers named stringifiers operations in webidl will just invoke the corresponding c++ method.
...And 2 more matches
Document.evaluate() - Web APIs
WebAPIDocumentevaluate
* the result will likely be an unordered node iterator.
... unordered_node_iterator_type 4 a result set containing all the nodes matching the expression.
... ordered_node_iterator_type 5 a result set containing all the nodes matching the expression.
...And 2 more matches
Map - JavaScript
iteration methods map.prototype[@@iterator]() returns a new iterator object that contains an array of [key, value] for each element in the map object in insertion order.
... map.prototype.keys() returns a new iterator object that contains the keys for each element in the map object in insertion order.
... map.prototype.values() returns a new iterator object that contains the values for each element in the map object in insertion order.
...And 2 more matches
yield - JavaScript
syntax [rv] = yield [expression] expression optional defines the value to return from the generator function via the iterator protocol.
... the yield keyword causes the call to the generator's next() method to return an iteratorresult object with two properties: value and done.
...in this case, execution of the generator ends and an iteratorresult is returned to the caller in which the value is undefined and done is true.
...And 2 more matches
for...of - JavaScript
cript function: (function() { for (const argument of arguments) { console.log(argument); } })(1, 2, 3); // 1 // 2 // 3 iterating over a dom collection iterating over dom collections like nodelist: the following example adds a read class to paragraphs that are direct descendants of an article: // note: this will only work in platforms that have // implemented nodelist.prototype[symbol.iterator] const articleparagraphs = document.queryselectorall('article > p'); for (const paragraph of articleparagraphs) { paragraph.classlist.add('read'); } closing iterators in for...of loops, abrupt iteration termination can be caused by break, throw or return.
... in these cases, the iterator is closed.
... function* foo(){ yield 1; yield 2; yield 3; }; for (const o of foo()) { console.log(o); break; // closes iterator, execution continues outside of the loop } console.log('done'); iterating over generators you can also iterate over generators, i.e.
...And 2 more matches
Task.jsm
you can use the yield operator inside the generator function to wait on a promise, spawn another task, or propagate a value: let resolutionvalue = yield (promise/generator/iterator/value); if you specify a promise, the yield operator returns its resolution value as soon as the promise is resolved.
... if you specify a generator function or the iterator returned by a generator function, then task.spawn() is implicitly called, and the yield operator works on the returned promise.
... promise spawn( atask ); parameters atask this parameter accepts different data types: if you specify a generator function, it is called with no arguments to retrieve the associated iterator.
... if you specify the iterator returned by a generator function you called, the generator function is also executed as a task.
JSNewEnumerateOp
(spidermonkey, noting the jsclass_new_enumerate flag, will cast that function pointer back to type jsnewenumerateop before calling it.) the behavior depends on the value of enum_op: jsenumerate_init a new, opaque iterator state should be allocated and stored in *statep.
... jsenumerate_next a previously allocated opaque iterator state is passed in via statep.
...the opaque iterator state pointed at by statep is destroyed and *statep is set to jsval_null if there are no properties left to enumerate.
... jsenumerate_destroy destroy the opaque iterator state previously allocated in *statep by a call to this function when enum_op was jsenumerate_init or jsenumerate_init_all.
Avoiding leaks in JavaScript XPCOM components
consider this example from bug 285065: function _filterradiogroup(anode) { switch (anode.localname) { case "radio": return nodefilter.filter_accept; case "template": case "radiogroup": return nodefilter.filter_reject; default: return nodefilter.filter_skip; } } var iterator = this.ownerdocument.createtreewalker(this, nodefilter.show_element, _filterradiogroup, true); while (iterator.nextnode()) radiochildren.push(iterator.currentnode); return this.mradiochildren = radiochildren; in this example, the iterator object is an xpcom object that is wrapped so the javascript code can use it.
...the reason closures matter here is that the _filterradiogroup function has access to the iterator variable.
... (var declarations inside javascript functions are function-scope, including the part of the function before the declaration.) this means that the value of iterator, the wrapper for the native tree walker, is reachable from the function.
... simply assigning iterator = null before the return is sufficient to fix the leak.
nsIXPCScriptable
this will always be one of three values: jsenumerate_init a new, opaque iterator state should be allocated and stored in statep.
... jsenumerate_next a previously allocated opaque iterator state is passed in via statep.
...the opaque iterator state pointed at by statep is destroyed and *statep is set to jsval_null if there are no properties left to enumerate.
... jsenumerate_destroy this function should destroy the opaque iterator state previously allocated in statep by this function when enum_op was jsenumerate_init.
DOMTokenList.entries() - Web APIs
the domtokenlist.entries() method returns an iterator allowing you to go through all key/value pairs contained in this object.
... syntax tokenlist.entries(); return value returns an iterator.
...we when retrieve an iterator containing the key/value pairs using entries(), then iterate through each one using a for...of loop, writing them to the <span>'s node.textcontent.
... first, the html: <span class="a b c"></span> now the javascript: let span = document.queryselector("span"); let classes = span.classlist; let iterator = classes.entries(); for (let value of iterator) { span.textcontent += value + ' ++ '; } the output looks like this: specifications specification status comment domthe definition of 'entries() (as iterable<node>)' in that specification.
DOMTokenList.keys() - Web APIs
WebAPIDOMTokenListkeys
the keys() method of the domtokenlist interface returns an iterator allowing to go through all keys contained in this object.
... return value returns an iterator.
...we when retrieve an iterator containing the keys using values(), then iterate through those keys using a for ...
... first, the html: <span class="a b c"></span> now the javascript: var span = document.queryselector("span"); var classes = span.classlist; var iterator = classes.keys(); for(var value of iterator) { span.textcontent += value + ' ++ '; } the output looks like this: specifications specification status comment domthe definition of 'keys() (as iterable<node>)' in that specification.
DOMTokenList.values() - Web APIs
the values() method of the domtokenlist interface returns an iterator allowing developers to go through all values contained in the domtokenlist.
... return value returns an iterator.
...we when retrieve an iterator containing the values using values(), then iterate through those values using a for ...
... first, the html: <span class="a b c"></span> now the javascript: var span = document.queryselector("span"); var classes = span.classlist; var iterator = classes.values(); for(var value of iterator) { span.textcontent += value + ' ++ '; } the output looks like this: specifications specification status comment domthe definition of 'values() (as iterable<node>)' in that specification.
MediaKeyStatusMap - Web APIs
methods mediakeystatusmap.entries() read only returns a new iterator object containing an array of [key, value] for each element in the status map, in insertion order.
... mediakeystatusmap.keys() read only returns a new iterator object containing keys for each element in the status map, in insertion order.
... mediakeystatusmap.values() read only returns a new iterator object containing values for each element in the status map, in insertion order.
... mediakeystatusmap.[@@iterator]() read only returns a new iterator object containing an array of [key, value] for each element in the status map, in insertion order.
NodeList - Web APIs
WebAPINodeList
nodelist.entries() returns an iterator, allowing code to go through all key/value pairs contained in the collection.
... nodelist.keys() returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection.
... (in this case, the keys are numbers starting from 0.) nodelist.values() returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection.
... for...of loops will loop over nodelist objects correctly: const list = document.queryselectorall('input[type=checkbox]'); for (let checkbox of list) { checkbox.checked = true; } recent browsers also support iterator methods (foreach()) as well as entries(), values(), and keys().
XPathResult.resultType - Web APIs
note that if the result is a node-set then unordered_node_iterator_type is always the resulting type.
... unordered_node_iterator_type 4 a result node-set containing all the nodes matching the expression.
... ordered_node_iterator_type 5 a result node-set containing all the nodes matching the expression.
... html <div>xpath example</div> <div>is xpath result a node set: <output></output></div> javascript var xpath = "//div"; var result = document.evaluate(xpath, document, null, xpathresult.any_type, null); document.queryselector("output").textcontent = result.resulttype >= xpathresult.unordered_node_iterator_type && result.resulttype <= xpathresult.first_ordered_node_type; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathresult.resulttype' in that specification.
XRInputSourceArray.entries() - Web APIs
the xrinputsourcearray interface's entries() method returns a javascript iterator which can then be used to iterate over the key/value pairs in the input source array.
... syntax let inputsourceiterator = xrinputsourcearray.entries(); for (let entry of xrinputsourcearray.entries()) { /* ...
... return value an iterator which can be used to walk through the list of xrinputsource objects included in the input source array.
... specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that specification.1 working draft xrinputsourcearray interface [1] see iterator-like methods in information contained in a webidl file for information on how an iterable declaration in an interface definition causes entries(), foreach(), keys(), and values() methods to be exposed from objects that implement the interface.
XRInputSourceArray.keys() - Web APIs
the keys() method in the xrinputsourcearray interface returns a javascript iterator which can then be used to iterate over the keys used to reference each item in the array of input sources.
... return value a javascript iterator that can be used to walk through the keys for each entry in the list of input sources.
... the values returned by the iterator are the indexes of each entry in the list; that is, the numbers 0, 1, 2, and so forth through the index of the last item in the list.
... specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that specification.1 working draft xrinputsourcearray interface [1] see iterator-like methods in information contained in a webidl file for information on how an iterable declaration in an interface definition causes entries(), foreach(), keys(), and values() methods to be exposed from objects that implement the interface.
TypeError: 'x' is not iterable - JavaScript
function* generate(a, b) { yield a; yield b; } for (let x of generate(1,2)) console.log(x); iterating over a custom iterable custom iterables can be created by implementing the symbol.iterator method.
... you must be certain that your iterator method returns an object which is an iterator, which is to say it must have a next method.
... const myemptyiterable = { [symbol.iterator]() { return [] // [] is iterable, but it is not an iterator -- it has no next method.
... } } array.from(myemptyiterable); // typeerror: myemptyiterable is not iterable here is a correct implementation: const myemptyiterable = { [symbol.iterator]() { return [][symbol.iterator]() } } array.from(myemptyiterable); // [] ...
Array - JavaScript
array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
BigInt64Array - JavaScript
bigint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... bigint64array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... bigint64array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... bigint64array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
BigUint64Array - JavaScript
biguint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... biguint64array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... biguint64array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... biguint64array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Float32Array - JavaScript
float32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... float32array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... float32array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... float32array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Float64Array - JavaScript
float64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... float64array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... float64array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... float64array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Generator.prototype.next() - JavaScript
return value an object with two properties: done (boolean) has the value true if the iterator is past the end of the iterated sequence.
... in this case value optionally specifies the return value of the iterator.
... has the value false if the iterator was able to produce the next value in the sequence.
... value any javascript value returned by the iterator.
Generator.prototype.throw() - JavaScript
return value an object with two properties: done (boolean) has the value true if the iterator is past the end of the iterated sequence.
... in this case value optionally specifies the return value of the iterator.
... has the value false if the iterator was able to produce the next value in the sequence.
... value any javascript value returned by the iterator.
Int16Array - JavaScript
int16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... int16array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... int16array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... int16array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Int32Array - JavaScript
int32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... int32array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... int32array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... int32array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Int8Array - JavaScript
int8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... int8array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... int8array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... int8array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Set - JavaScript
iteration methods set.prototype[@@iterator]() returns a new iterator object that yields the values for each element in the set object in insertion order.
... set.prototype.keys() returns a new iterator object that yields the values for each element in the set object in insertion order.
... (for sets, this is the same as the values() method.) set.prototype.values() returns a new iterator object that yields the values for each element in the set object in insertion order.
... (for sets, this is the same as the keys() method.) set.prototype.entries() returns a new iterator object that contains an array of [value, value] for each element in the set object, in insertion order.
String.prototype.matchAll() - JavaScript
the matchall() method returns an iterator of all results matching a string against a regular expression, including capturing groups.
... return value an iterator (which is not a restartable iterable).
... instead, by using matchall, you get an iterator to use with the more convenient for...of, array spread, or array.from() constructs: const regexp = regexp('foo[a-z]*','g'); const str = 'table football, foosball'; const matches = str.matchall(regexp); for (const match of matches) { console.log(`found ${match[0]} start=${match.index} end=${match.index + match[0].length}.`); } // expected output: "found football start=6 end=14." // expected ou...
...tput: "found foosball start=16 end=24." // matches iterator is exhausted after the for..of iteration // call matchall again to create a new iterator array.from(str.matchall(regexp), m => m[0]); // array [ "football", "foosball" ] matchall will throw an exception if the g flag is missing.
Symbol - JavaScript
static properties symbol.asynciterator a method that returns the default asynciterator for an object.
... symbol.iterator a method returning the default iterator for an object.
... symbol.matchall a method that returns an iterator, that yields matches of the regular expression against a string.
... typeof symbol() === 'symbol' typeof symbol('foo') === 'symbol' typeof symbol.iterator === 'symbol' symbol type conversions some things to note when working with type conversion of symbols.
TypedArray - JavaScript
typedarray.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... typedarray.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... typedarray.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... typedarray.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Uint16Array - JavaScript
uint16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... uint16array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... uint16array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... uint16array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Uint32Array - JavaScript
uint32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... uint32array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... uint32array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... uint32array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Uint8Array - JavaScript
uint8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... uint8array.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... uint8array.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... uint8array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
Uint8ClampedArray - JavaScript
uint8clampedarray.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array.
... uint8clampedarray.prototype.keys() returns a new array iterator that contains the keys for each index in the array.
... uint8clampedarray.prototype.values() returns a new array iterator object that contains the values for each index in the array.
... uint8clampedarray.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array.
yield* - JavaScript
the value of yield* expression itself is the value returned by that iterator when it's closed (i.e., when done is true).
... function* g1() { yield 2; yield 3; yield 4; } function* g2() { yield 1; yield* g1(); yield 5; } const iterator = g2(); console.log(iterator.next()); // {value: 1, done: false} console.log(iterator.next()); // {value: 2, done: false} console.log(iterator.next()); // {value: 3, done: false} console.log(iterator.next()); // {value: 4, done: false} console.log(iterator.next()); // {value: 5, done: false} console.log(iterator.next()); // {value: undefined, done: true} other iterable objects besides generator objects, yield* can also yield other kinds of iterables (e.g., arrays, strings, or arguments objects).
... function* g3() { yield* [1, 2]; yield* '34'; yield* array.from(arguments); } const iterator = g3(5, 6); console.log(iterator.next()); // {value: 1, done: false} console.log(iterator.next()); // {value: 2, done: false} console.log(iterator.next()); // {value: "3", done: false} console.log(iterator.next()); // {value: "4", done: false} console.log(iterator.next()); // {value: 5, done: false} console.log(iterator.next()); // {value: 6, done: false} console.log(iterator.next()); // {value: undefined, done: true} the value of yield* expression itself yield* is an expression, not a statement—so it evaluates to a value.
... function* g4() { yield* [1, 2, 3]; return 'foo'; } function* g5() { const g4returnvalue = yield* g4(); console.log(g4returnvalue) // 'foo' return g4returnvalue; } const iterator = g5(); console.log(iterator.next()); // {value: 1, done: false} console.log(iterator.next()); // {value: 2, done: false} console.log(iterator.next()); // {value: 3, done: false} done is false because g5 generator isn't finished, only g4 console.log(iterator.next()); // {value: 'foo', done: true} specifications specification ecmascript (ecma-262)the definition of 'yield' in that specification.
Generator comprehensions - Archive of obsolete content
suppose we have an iterator it which iterates over a large sequence of integers.
... we want to create a new iterator that will iterate over their doubles.
... an array comprehension would create a full array in memory containing the doubled values: var doubles = [for (i in it) i * 2]; a generator comprehension on the other hand would create a new iterator which would create doubled values on demand as they were needed: var it2 = (for (i in it) i * 2); console.log(it2.next()); // the first value from it, doubled console.log(it2.next()); // the second value from it, doubled when a generator comprehension is used as the argument to a function, the parentheses used for the function call means that the outer parentheses can be omitted: var result = dosomething(for (i in it) i * 2); the significant difference between the two examples being that by using the generator comprehension, you would only have to loop over the 'obj' structure once, total, as...
ECMAScript 2015 support in Mozilla - Archive of obsolete content
ntat() (firefox 29) string.prototype.startswith(), string.prototype.endswith() (firefox 17) string.prototype.includes() (firefox 40) (formerly string.prototype.contains() (firefox 17)) string.prototype.repeat() (firefox 24) string.prototype.normalize() (firefox 31) string.raw() (firefox 34) \u{xxxxxx} unicode code point escapes (firefox 40) new symbol object symbol (firefox 36) symbol.iterator (firefox 36) symbol.for() - global symbol registry (firefox 36) symbol.match (firefox 40) symbol.species (firefox 41) symbol.toprimitive (firefox 44) symbol.prototype[@@toprimitive] (firefox 44) symbol.replace (firefox 49) symbol.search (firefox 49) symbol.split (firefox 49) symbol.hasinstance (firefox 50) typed arrays typed arrays are specified as part of ecmascript 2015 and no longe...
... arraybuffer get arraybuffer[@@species] (firefox 48) dataview int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array get %typedarray%[@@species] (firefox 48) expressions and operators new.target (firefox 41) spread operator for arrays (firefox 16) use symbol.iterator property (firefox 36) spread operator for function calls (firefox 27) use symbol.iterator property (firefox 36) const (js 1.5, firefox 1.0) (es2015 compliance bug 950547 implemented in firefox 51) let (js 1.7, firefox 2) (es2015 compliance bug 950547 implemented in firefox 51) destructuring assignment (js 1.7, firefox 2) (es2015 compliance bug 1055984) statements for...of (firefox 13) works in...
... terms of .iterator() and .next() (firefox 17) use "@@iterator" property (firefox 27) use symbol.iterator property (firefox 36) functions rest parameters (firefox 15) default parameters (firefox 15) parameters without defaults after default parameters (firefox 26) destructured parameters with default value assignment (firefox 41) arrow functions (firefox 22) generator function (firefox 26) yield (firefox 26) yield* (firefox 27) arguments[@@iterator] (firefox 46) other features binary and octal numeric literals (firefox 25) template strings (firefox 34) object initializer: shorthand property names (firefox 33) object initializer: computed property names (firefox 34) object initializer: shorthand method names (firefox 34) ...
Reflect.enumerate() - Archive of obsolete content
the static reflect.enumerate() method used to return an iterator with the enumerable own and inherited properties of the target object, but has been removed in ecmascript 2016 and is deprecated in browsers.
... return value an iterator with the enumerable own and inherited properties of the target object.
... description the reflect.enumerate method returns an iterator with the enumerable own and inherited properties of the target object.
Looping code - Learn web development
an iterator, which generally increments the counter by a small amount on each successive loop, until the condition is no longer true.
...the for loop is given a counter starting at 1 (as we are not interested in 0 in this case), an exit condition that says the loop will stop when the counter becomes bigger than the input num, and an iterator that adds 1 to the counter each time.
... remember to include an iterator!
Dict.jsm
items iterator returns an iterator over all of the items in the dictionary; each item is returned as a pair (a two-element array) with the first element being the key and the second being the value.
... keys iterator returns an iterator over all the keys in the dictionary.
... values iterator returns an iterator over all the values in the dictionary.
OSFile.jsm
calling os.file.directoryiterator from the main thread asynchronous, off-main thread file directory access, main thread api.
... os.file for workers synchronous file i/o for worker threads os.file.directoryiterator for workers visiting directories synchronously from a worker thread ...
... shared components os.path and os.constants.path manipulation of paths os.file.error representation of file-related errors os.file.info representation of file information (size, creation date, etc.) os.file.directoryiterator.entry file information obtained while visiting a directory ...
JSExtendedClass
syntax struct jsextendedclass { jsclass base; jsequalityop equality; jsobjectop outerobject; jsobjectop innerobject; jsiteratorop iteratorobject;// added in spidermonkey 1.8 jsobjectop wrappedobject; // added in spidermonkey 1.8 ...and additional reserved fields.
... iteratorobject jsiteratorop added in spidermonkey 1.8 optional.
... creates and returns a new iterator.
JSAPI reference
runtimes and contexts js_init added in spidermonkey 31 js_shutdown struct jsruntime js_newruntimeobsolete since jsapi 52 js_destroyruntime js_getruntimeprivate js_setruntimeprivate js_setnativestackquota added in spidermonkey 17 js_contextiteratorobsolete since jsapi 52 js_finish obsolete since jsapi 19 struct jscontext js_newcontext js_destroycontext js_destroycontextnogc js_setcontextcallback enum jscontextop js_getruntime js_getparentruntime added in spidermonkey 31 js_getobjectruntime added in spidermonkey 17 js_getcontextprivate js_setcontextprivate js_getsecondcontextprivate added in spidermonkey 17...
...erandsetter obsolete since jsapi 26 js_getpropertyattrsgetterandsetterbyid obsolete since jsapi 26 js_lookupproperty obsolete since jsapi 37 js_lookupucproperty obsolete since jsapi 37 js_lookuppropertybyid obsolete since jsapi 37 js_lookupelement obsolete since jsapi 37 js_lookuppropertywithflags obsolete since jsapi 31 js_lookuppropertywithflagsbyid obsolete since jsapi 31 js_newpropertyiterator obsolete since jsapi 36 js_nextproperty obsolete since jsapi 36 js_setpropertyattributes obsolete since jsapi 26 js_setucpropertyattributes obsolete since jsapi 26 the following functions behave like js_getproperty and js_getpropertybyid except when operating on e4x xml objects.
... jsiteratorop obsolete since jsapi 26 jsequalityop obsolete since javascript 1.8.5 jsobjectop obsolete since javascript 1.8.5 jsobjectops method types: in js 1.8.5, jsobjectops has been made private.
SpiderMonkey 1.8
this includes iterators and generators (bug 349263) and arrays (bug 417501).
... in short, applications that share objects among threads in such a way that two threads could access an array, iterator, or generator object at the same time should not use spidermonkey 1.8.
... there are two new jsextendedclass hooks, jsextendedclass.iteratorobject and jsextendedclass.wrappedobject.
Index
MozillaTechXPCOMIndex
466 nsidnsrecord interfaces, interfaces:scriptable, xpcom, xpcom interface reference this function copies the value of the next ip address into the given prnetaddr struct and increments the internal address iterator.
... 530 nsidomxpathresult dom, interfaces, interfaces:scriptable, xpcom, xpcom interface reference, xpath iterates through the available nodes of an unordered_node_iterator_type or ordered_node_iterator_type result.
... 549 nsidirectoryiterator directories, file i/o, interfaces, interfaces:scriptable, needscontent, xpcom interface reference the nsidirectoryiterator interface provides a way to iterate over the entries in a directory.
nsDependentCSubstring
methods constructors void nsdependentcsubstring(const nsacstring_internal&, pruint32, pruint32) - source parameters nsacstring_internal& str pruint32 startpos pruint32 length void nsdependentcsubstring(const char*, const char*) - source parameters char* start char* end void nsdependentcsubstring(const nsreadingiterator<char>&, const nsreadingiterator<char>&) - source parameters nsreadingiterator<char>& start nsreadingiterator<char>& end void nsdependentcsubstring() - source rebind void rebind(const nsacstring_internal&, pruint32, pruint32) - source parameters nsacstring_internal& <anonymous> pruint32 startpos pruint32 length void rebind(const char*, const char*) - source parameters char* s...
...tart char* end beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<char>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& begin...
...writing(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated prbool isterminated() const - source charat char charat(pruint32) const - source parameters pruint32 i operator[] char operator[](pruint32) const - source parameters pruint32 i first char first() const - source last char last() const - source countchar pruint32 countchar(char) ...
nsDependentSubstring
methods constructors void nsdependentsubstring(const nsastring_internal&, pruint32, pruint32) - source parameters nsastring_internal& str pruint32 startpos pruint32 length void nsdependentsubstring(const prunichar*, const prunichar*) - source parameters prunichar* start prunichar* end void nsdependentsubstring(const nsreadingiterator<short unsigned int>&, const nsreadingiterator<short unsigned int>&) - source parameters nsreadingiterator<short unsigned int>& start nsreadingiterator<short unsigned int>& end void nsdependentsubstring() - source rebind void rebind(const nsastring_internal&, pruint32, pruint32) - source parameters nsastring_internal& <anonymous> pruint32 startpos pruint32 length void rebind(con...
...st prunichar*, const prunichar*) - source parameters prunichar* start prunichar* end beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* begin...
...writing() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - source parameters prunichar*& iter data prunichar* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source istermin...
nsIDNSRecord
methods native code only!getnextaddr this function copies the value of the next ip address into the given prnetaddr struct and increments the internal address iterator.
...getnextaddrasstring() this function returns the value of the next ip address as a string and increments the internal address iterator.
...rewind() this function resets the internal address iterator to the first address in the record.
DOMTokenList - Web APIs
domtokenlist.entries() returns an iterator, allowing you to go through all key/value pairs contained in this object.
... domtokenlist.keys() returns an iterator, allowing you to go through all keys of the key/value pairs contained in this object.
... domtokenlist.values() returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
Using Fetch - Web APIs
the following example shows one way to do this by creating a line iterator (for simplicity, it assumes the text is utf-8, and doesn't handle fetch errors).
... async function* maketextfilelineiterator(fileurl) { const utf8decoder = new textdecoder('utf-8'); const response = await fetch(fileurl); const reader = response.body.getreader(); let { value: chunk, done: readerdone } = await reader.read(); chunk = chunk ?
...utf8decoder.decode(chunk) : ''); startindex = re.lastindex = 0; continue; } yield chunk.substring(startindex, result.index); startindex = re.lastindex; } if (startindex < chunk.length) { // last line didn't end in a newline char yield chunk.substr(startindex); } } async function run() { for await (let line of maketextfilelineiterator(urloffile)) { processline(line); } } run(); checking that the fetch was successful a fetch() promise will reject with a typeerror when a network error is encountered or cors is misconfigured on the server-side, although this usually means permission issues or similar — a 404 does not constitute a network error, for example.
FormData.entries() - Web APIs
WebAPIFormDataentries
the formdata.entries() method returns an iterator allowing to go through all key/value pairs contained in this object.
... syntax formdata.entries(); return value returns an iterator.
...te a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the key/value pairs for(var pair of formdata.entries()) { console.log(pair[0]+ ', '+ pair[1]); } the result is: key1, value1 key2, value2 specifications specification status comment xmlhttprequestthe definition of 'entries() (as iterator<>)' in that specification.
FormData.keys() - Web APIs
WebAPIFormDatakeys
the formdata.keys() method returns an iterator allowing to go through all keys contained in this object.
... syntax formdata.keys(); return value returns an iterator.
... example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the keys for (var key of formdata.keys()) { console.log(key); } the result is: key1 key2 specifications specification status comment xmlhttprequestthe definition of 'keys() (as iterator<>)' in that specification.
FormData.values() - Web APIs
WebAPIFormDatavalues
the formdata.values() method returns an iterator allowing to go through all values contained in this object.
... syntax formdata.values(); return value returns an iterator.
... example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the values for (var value of formdata.values()) { console.log(value); } the result is: value1 value2 specifications specification status comment xmlhttprequestthe definition of 'values() (as iterator<>)' in that specification.
FormData - Web APIs
WebAPIFormData
formdata.entries() returns an iterator allowing to go through all key/value pairs contained in this object.
... formdata.keys() returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
... formdata.values() returns an iterator allowing to go through all values contained in this object.
Headers - Web APIs
WebAPIHeaders
headers.entries() returns an iterator allowing to go through all key/value pairs contained in this object.
... headers.keys() returns an iterator allowing you to go through all keys of the key/value pairs contained in this object.
... headers.values() returns an iterator allowing you to go through all values of the key/value pairs contained in this object.
MediaKeyStatusMap.keys() - Web APIs
the keys property of the mediakeystatusmap interface returns a new iterator object, containing keys for each element in the status map, in insertion order.
... syntax var iterator = mediakeystatusmap.keys() parameters none.
... returns a new iterator.
MediaKeyStatusMap.values() - Web APIs
the values property of the mediakeystatusmap interface returns a new iterator object, containing values for each element in the status map, in insertion order.
... syntax var iterator = mediakeystatusmap.values() parameters none.
... returns a new iterator.
URLSearchParams - Web APIs
urlsearchparams.entries() returns an iterator allowing iteration through all key/value pairs contained in this object.
... urlsearchparams.keys() returns an iterator allowing iteration through all keys of the key/value pairs contained in this object.
... urlsearchparams.values() returns an iterator allowing iteration through all values of the key/value pairs contained in this object.
XRInputSourceArray.values() - Web APIs
the xrinputsourcearray method values() returns a javascript iterator that can walk over the list of xrinputsource objects contained in the array, from first to last.
... return value a javascript iterator that can be used to walk through the list of xrinputsource objects in the array, starting with the first entry (at index 0) and proceeding straight through the list.
... specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that specification.1 working draft xrinputsourcearray interface [1] see iterator-like methods in information contained in a webidl file for information on how an iterable declaration in an interface definition causes entries(), foreach(), keys(), and values() methods to be exposed from objects that implement the interface.
XRInputSourceArray - Web APIs
in addition to being able to access the input sources in the list using standard array notation (that is, with index numbers insize square brackets), methods are available to allow the use of iterators and the foreach() method is also available.
... entries() returns an iterator you can use to walk the list of key/value pairs in the list.
... values() returns an iterator you can use to go through all the values in the list.
Deprecated and obsolete features - JavaScript
iterator stopiteration is deprecated.
... iterator is deprecated.
... __iterator__ is deprecated.
Array.prototype.entries() - JavaScript
the entries() method returns a new array iterator object that contains the key/value pairs for each index in the array.
... syntax array.entries() return value a new array iterator object.
... examples iterating with index and element const a = ['a', 'b', 'c']; for (const [index, element] of a.entries()) console.log(index, element); // 0 'a' // 1 'b' // 2 'c' using a for…of loop var a = ['a', 'b', 'c']; var iterator = a.entries(); for (let e of iterator) { console.log(e); } // [0, 'a'] // [1, 'b'] // [2, 'c'] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.entries' in that specification.
Array.prototype.keys() - JavaScript
the keys() method returns a new array iterator object that contains the keys for each index in the array.
... syntax arr.keys() return value a new array iterator object.
... examples key iterator doesn't ignore holes var arr = ['a', , 'c']; var sparsekeys = object.keys(arr); var densekeys = [...arr.keys()]; console.log(sparsekeys); // ['0', '2'] console.log(densekeys); // [0, 1, 2] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.keys' in that specification.
TypedArray.from() - JavaScript
when the source parameter is an iterator, the typedarray.from() first collects all the values from the iterator, then creates an instance of thisarg using the count, then sets the values on the instance.
... array.from() sets each value as it receives them from the iterator, then sets its length at the end.
... when array.from() gets an array-like which isn't an iterator, it respects holes.
function* - JavaScript
calling a generator function does not execute its body immediately; an iterator object for the function is returned instead.
... when the iterator's next() method is called, the generator function's body is executed until the first yield expression, which specifies the value to be returned from the iterator or, with yield*, delegates to another generator function.
...o { *generator () { yield 1; yield 2; yield 3; } } const f = new foo (); const gen = f.generator(); console.log(gen.next()); // { value: 1, done: false } console.log(gen.next()); // { value: 2, done: false } console.log(gen.next()); // { value: 3, done: false } console.log(gen.next()); // { value: undefined, done: true } generator as a computed property class foo { *[symbol.iterator] () { yield 1; yield 2; } } const someobj = { *[symbol.iterator] () { yield 'a'; yield 'b'; } } console.log(array.from(new foo)); // [ 1, 2 ] console.log(array.from(someobj)); // [ 'a', 'b' ] generators are not constructable function* f() {} var obj = new f; // throws "typeerror: f is not a constructor generator defined in an expression const foo = function* () { y...
Statements and declarations - JavaScript
function* generator functions enable writing iterators more easily.
... for...of iterates over iterable objects (including arrays, array-like objects, iterators and generators), invoking a custom iteration hook with statements to be executed for the value of each distinct property.
... for await...of iterates over async iterable objects, array-like objects, iterators and generators, invoking a custom iteration hook with statements to be executed for the value of each distinct property.
New in JavaScript 1.7 - Archive of obsolete content
javascript 1.7 is a language update introducing several new features, in particular generators, iterators, array comprehensions, let expressions, and destructuring assignment.
... iterators and generators array comprehensions let statement (support for let expression was dropped in gecko 41, see bug 1023609).
New in JavaScript 1.8 - Archive of obsolete content
however, that made it impossible to destructure the values of an array - that were arrays (i.e., when an iterator returns an array of the current key-value pair).
...one can, however, use for ( var [key, value] in iterator(array)).
handler.enumerate() - Archive of obsolete content
return value an iterator object.
... var p = new proxy({}, { enumerate(target) { console.log('called'); return ['a', 'b', 'c'][symbol.iterator](); } }); for (var x in p) { // "called" console.log(x); // "a" } // "b" // "c" the following code violates the invariant.
Archived open Web documentation - Archive of obsolete content
iterator the iterator function returns an object which implements legacy iterator protocol and iterates over enumerable properties of an object.
...if you're using older versions of tools that rely on old browser bugs or generate browser-specific code, it may be time to upgrade: stopiteration the stopiteration object was used to tell the end of the iteration in the legacy iterator protocol.
Symbol - MDN Web Docs Glossary: Definitions of Web-related terms
examples of well-known symbols are: symbol.iterator for array-like objects, or symbol.search for string objects.
... they are listed in the specification in the well-known symbols table: symbol.hasinstance symbol.isconcatspreadable symbol.iterator symbol.toprimitive …and so on.
Test your skills: Loops - Learn web development
you are given three variables to begin with: i — starts off with a value of 0; intended to be used as an iterator.
... loops 3 in this final task, you are provided with the following: i — starts off with a value of 500; intended to be used as an iterator.
JS_FS
for example, use js_sym_fn(iterator, ...) to define an @@iterator method.
... (in builds without es6 symbols, it defines a method with the string id "@@iterator".) see an example in the jsapi user guide.
JS_NextProperty
get the next property id from an iterator object produced by js_newpropertyiterator.
... iterobj js::handleobject the opaque iterator object returned by a previous call to js_newpropertyiterator.
JSDBGAPI
_cleartrap js_clearscripttraps js_clearalltraps js_handletrap js_setinterrupt js_clearinterrupt watchpoints js_setwatchpoint js_clearwatchpoint js_clearwatchpointsforobject js_clearallwatchpoints inspecting the stack js_pctolinenumber js_linenumbertopc js_getfunctionscript js_getfunctionnative js_getfunctionfastnative js_getscriptprincipals typedef jsstackframe js_frameiterator js_getframescript js_getframepc js_getscriptedcaller js_stackframeprincipals js_evalframeprincipals js_getframeannotation js_setframeannotation js_getframeprincipalarray js_isnativeframe js_getframeobject js_getframescopechain js_getframecallobject js_getframethis js_getframefunction js_getframefunctionobject js_isconstructorframe js_isdebuggerframe js_getframereturnvalue js_...
...ameflags js_getscriptfilenameflags js_flagscriptfilenameprefix jsfilename_null jsfilename_system jsfilename_protected evaluating debug code js_evaluateinstackframe examining object properties typedef jspropertydesc jspd_enumerate jspd_readonly jspd_permanent jspd_alias jspd_argument jspd_variable jspd_exception jspd_error typedef jspropertydescarray js_propertyiterator js_getpropertydesc js_getpropertydescarray js_putpropertydescarray hooks js_setdebuggerhandler js_setsourcehandler js_setexecutehook js_setcallhook js_setobjecthook js_setthrowhook js_setdebugerrorhook js_setnewscripthook js_setdestroyscripthook js_getglobaldebughooks js_setcontextdebughooks memory usage js_getobjecttotalsize js_getfunctiontotalsize js_getscripttotalsi...
NS_ConvertASCIItoUTF16
his string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
NS_ConvertUTF16toUTF8
to this string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<ch...
...ar>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated ...
NS_ConvertUTF8toUTF16
his string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
NS_LossyConvertUTF16toASCII
to this string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<ch...
...ar>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated ...
nsACString_internal
parameters nscsubstringtuple& tuple void nsacstring_internal(char*, pruint32, pruint32) - source parameters char* data pruint32 length pruint32 flags beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<ch...
...ar>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated ...
nsAString_internal
parameters nssubstringtuple& tuple void nsastring_internal(prunichar*, pruint32, pruint32) - source parameters prunichar* data pruint32 length pruint32 flags beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
nsAdoptingCString
to this string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<ch...
...ar>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated ...
nsAdoptingString
his string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
nsAutoString
his string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
nsCAutoString
32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters ...
... nsreadingiterator<char>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() ...
nsCString
to this string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<ch...
...ar>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated ...
nsDependentCString
to this string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<ch...
...ar>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated ...
nsDependentString
his string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
nsFixedCString
to this string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<ch...
...ar>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated ...
nsFixedString
his string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
nsPromiseFlatCString
to this string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<ch...
...ar>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated ...
nsPromiseFlatString
his string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
nsString
his string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
nsXPIDLCString
to this string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter endreading char* endreading() const - source nsreadingiterator<char>& endreading(nsreadingiterator<char>&) const - source parameters nsreadingiterator<ch...
...ar>& iter char*& endreading(const char*&) const - source parameters char*& iter beginwriting char* beginwriting() - source writing iterators nswritingiterator<char>& beginwriting(nswritingiterator<char>&) - source deprecated writing iterators parameters nswritingiterator<char>& iter char*& beginwriting(char*&) - source parameters char*& iter endwriting char* endwriting() - source nswritingiterator<char>& endwriting(nswritingiterator<char>&) - source parameters nswritingiterator<char>& iter char*& endwriting(char*&) - source parameters char*& iter data char* data() const - source accessors length pruint32 length() const - source isempty prbool isempty() const - source isvoid prbool isvoid() const - source isterminated ...
nsXPIDLString
his string parameters pruint32 ainteger print32 aradix void appendint(print64, print32) - source parameters print64 ainteger print32 aradix appendfloat void appendfloat(float) - source append the given float to this string parameters float afloat void appendfloat(double) - source parameters double afloat beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& beginreading(const prunichar*&) const - source parameters prunichar*& iter endreading prunichar* endreading() const - source nsreadingiterator<short unsigned int>& endreading...
...(nsreadingiterator<short unsigned int>&) const - source parameters nsreadingiterator<short unsigned int>& iter prunichar*& endreading(const prunichar*&) const - source parameters prunichar*& iter beginwriting prunichar* beginwriting() - source writing iterators nswritingiterator<short unsigned int>& beginwriting(nswritingiterator<short unsigned int>&) - source deprecated writing iterators parameters nswritingiterator<short unsigned int>& iter prunichar*& beginwriting(prunichar*&) - source parameters prunichar*& iter endwriting prunichar* endwriting() - source nswritingiterator<short unsigned int>& endwriting(nswritingiterator<short unsigned int>&) - source parameters nswritingiterator<short unsigned int>& iter prunichar*& endwriting(prunichar*&) - sourc...
Folders and message lists
it's used like this: // import the fixiterator() function.
... components.utils.import("resource:///modules/iteratorutils.jsm"); for (let msghdr in fixiterator(myfolder.messages, components.interfaces.nsimsgdbhdr)) { // do something with msghdr...
CSSUnparsedValue - Web APIs
cssunparsedvalue.keys() returns a new array iterator object that contains the keys for each index in the cssunparsedvalue object.
... cssunparsedvalue.values() returns a new array iterator object that contains the values for each index in the cssunparsedvalue object.
DOMTokenList.forEach() - Web APIs
we when retrieve an iterator containing the values using foreach(), writing each one to the <span>'s node.textcontent inside the foreach() inner function.
... html <span class="a b c"></span> javascript let span = document.queryselector("span"); let classes = span.classlist; let iterator = classes.values(); classes.foreach( function(value, key, listobj) { span.textcontent += `${value} ${key}/${this} ++ `; }, "arg" ); result polyfill this polyfill adds compatibility to all browsers supporting es5: if (window.domtokenlist && !domtokenlist.prototype.foreach) { domtokenlist.prototype.foreach = function (callback, thisarg) { thisarg = thisarg || window; for (var i = 0; i < this.length; i++) { callback.call(thisarg, this[i], i, this); } }; } specifications specification status comment domthe definition of 'foreach() (as iterable<node>)' in that specification.
Headers.entries() - Web APIs
WebAPIHeadersentries
the headers.entries() method returns an iterator allowing to go through all key/value pairs contained in this object.
... syntax headers.entries(); return value returns an iterator.
Headers.keys() - Web APIs
WebAPIHeaderskeys
the headers.keys() method returns an iterator allowing to go through all keys contained in this object.
... syntax headers.keys(); return value returns an iterator.
Headers.values() - Web APIs
WebAPIHeadersvalues
the headers.values() method returns an iterator allowing to go through all values contained in this object.
... syntax headers.values(); return value returns an iterator.
KeyboardLayoutMap.keys - Web APIs
the keys read-only property of the keyboardlayoutmap interface returns a new array iterator object that contains the keys for each index in the array.
... syntax iterator = keyboardlayoutmap.keys value an iterator.
KeyboardLayoutMap.values - Web APIs
the values read-only property of the keyboardlayoutmap interface returns a new array iterator object that contains the values for each index in the map.
... syntax var iterator = keyboardlayoutmap.values value an iterator.
KeyboardLayoutMap - Web APIs
keyboardlayoutmap.keys read only returns a new array iterator object that contains the keys for each index in the array.
... keyboardlayoutmap.values read only returns a new array iterator object that contains the values for each index in the keyboardlayoutmap object.
NodeList.entries() - Web APIs
WebAPINodeListentries
the nodelist.entries() method returns an iterator allowing to go through all key/value pairs contained in this object.
... syntax list.entries(); return value returns an iterator.
NodeList.keys() - Web APIs
WebAPINodeListkeys
the nodelist.keys() method returns an iterator allowing to go through all keys contained in this object.
... syntax nodelist.keys(); return value returns an iterator.
NodeList.values() - Web APIs
WebAPINodeListvalues
the nodelist.values() method returns an iterator allowing to go through all values contained in this object.
... syntax nodelist.values(); return value returns an iterator.
ReadableStream - Web APIs
readablestream.getiterator() creates a readablestream async iterator instance and locks the stream to it.
... readablestream[@@asynciterator]() alias of getiterator method.
ReadableStreamDefaultReader.read() - Web APIs
async function* maketextfilelineiterator(fileurl) { const utf8decoder = new textdecoder("utf-8"); let response = await fetch(fileurl); let reader = response.body.getreader(); let {value: chunk, done: readerdone} = await reader.read(); chunk = chunk ?
...utf8decoder.decode(chunk) : ""); startindex = re.lastindex = 0; continue; } yield chunk.substring(startindex, result.index); startindex = re.lastindex; } if (startindex < chunk.length) { // last line didn't end in a newline char yield chunk.substr(startindex); } } for await (let line of maketextfilelineiterator(urloffile)) { processline(line); } specifications specification status comment streamsthe definition of 'read()' in that specification.
StylePropertyMapReadOnly - Web APIs
stylepropertymapreadonly.keys() returns a new array iterator containing the keys for each item in stylepropertymapreadonly.
... stylepropertymapreadonly.values() returns a new array iterator containing the values for each index in the stylepropertymapreadonly object.
URLSearchParams.entries() - Web APIs
the entries() method of the urlsearchparams interface returns an iterator allowing iteration through all key/value pairs contained in this object.
... return value returns an iterator.
URLSearchParams.keys() - Web APIs
the keys() method of the urlsearchparams interface returns an iterator allowing iteration through all keys contained in this object.
... return value returns an iterator.
URLSearchParams.values() - Web APIs
the values() method of the urlsearchparams interface returns an iterator allowing iteration through all values contained in this object.
... return value returns an iterator.
Warning: JavaScript 1.6's for-each-in loops are deprecated - JavaScript
if (array) { for (var x of array) { console.log(x); } } } func([10, 20]); // 10 // 20 func(null); // prints nothing func(undefined); // prints nothing iterating over an object's key-value pair deprecated syntax there's a deprecated idiom to iterate over the specified object's key-value pairs using for each...in and the deprecated iterator object.
... var object = { a: 10, b: 20 }; for each (var [key, value] in iterator(object)) { console.log(key, value); // "a", 10 // "b", 20 } alternative standard syntax you can now use the standard for...in loop to iterate over specified object keys, and get each value inside the loop: var object = { a: 10, b: 20 }; for (var key in object) { var value = object[key]; console.log(key, value); // "a", 10 // "b", 20 } or, using for...of (es2015) and object.entries (es2017), you can get an array of the specified object values and iterate over the array like this: var object = { a: 10, b: 20 }; for (var [key, value] of object.entries(object)) { console.log(key, value); // "a", 10 // "b", 20 } ...
Generator - JavaScript
the generator object is returned by a generator function and it conforms to both the iterable protocol and the iterator protocol.
... examples an infinite iterator function* infinite() { let index = 0; while (true) { yield index++; } } const generator = infinite(); // "generator { }" console.log(generator.next().value); // 0 console.log(generator.next().value); // 1 console.log(generator.next().value); // 2 // ...
Map.prototype.entries() - JavaScript
the entries() method returns a new iterator object that contains the [key, value] pairs for each element in the map object in insertion order.
... syntax mymap.entries() return value a new map iterator object.
Map.prototype.keys() - JavaScript
the keys() method returns a new iterator object that contains the keys for each element in the map object in insertion order.
... syntax mymap.keys() return value a new map iterator object.
Map.prototype.values() - JavaScript
the values() method returns a new iterator object that contains the values for each element in the map object in insertion order.
... syntax mymap.values() return value a new map iterator object.
RegExp.prototype[@@matchAll]() - JavaScript
return value an iterator.
... for example, to return an array instead of an iterator: class myregexp extends regexp { [symbol.matchall](str) { const result = regexp.prototype[symbol.matchall].call(this, str); if (!result) { return null; } else { return array.from(result); } } } const re = new myregexp('([0-9]+)-([0-9]+)-([0-9]+)', 'g'); const str = '2016-01-02|2019-03-07'; const result = str.matchall(re); console.log(result[0]); // [ "2016-01-02"...
Set.prototype.entries() - JavaScript
the entries() method returns a new iterator object that contains an array of [value, value] for each element in the set object, in insertion order.
... syntax myset.entries() return value a new iterator object that contains an array of [value, value] for each element in the given set, in insertion order.
Set.prototype.values() - JavaScript
the values() method returns a new iterator object that contains the values for each element in the set object in insertion order.
... syntax myset.values(); return value a new iterator object containing the values for each element in the given set, in insertion order.
String - JavaScript
string.prototype.matchall(regexp) returns an iterator of all regexp's matches.
... string.prototype.@@iterator() returns a new iterator object that iterates over the code points of a string value, returning each code point as a string value.
TypedArray.prototype.entries() - JavaScript
the entries() method returns a new array iterator object that contains the key/value pairs for each index in the array.
... syntax arr.entries() return value a new array iterator object.
TypedArray.prototype.keys() - JavaScript
the keys() method returns a new array iterator object that contains the keys for each index in the array.
... syntax arr.keys() return value a new array iterator object.
TypedArray.prototype.values() - JavaScript
the values() method returns a new array iterator object that contains the values for each index in the array.
... syntax arr.values() return value a new array iterator object.
for await...of - JavaScript
for await...of doesn't work with async iterators that are not async iterables.
... examples iterating over async iterables you can also iterate over an object that explicitly implements async iterable protocol: const asynciterable = { [symbol.asynciterator]() { return { i: 0, next() { if (this.i < 3) { return promise.resolve({ value: this.i++, done: false }); } return promise.resolve({ done: true }); } }; } }; (async function() { for await (let num of asynciterable) { console.log(num); } })(); // 0 // 1 // 2 iterating over async generators since the return values of asyn...
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
use .setlength() instead: nsstring mystring = somestring; - mystring.truncate(4); + mystring.setlength(4); the frozen string api doesn't support the iterator or const_iterator classes, but you can use pointers the same way: nsstring mystring = somestring; - nsstring::const_iterator begin, end;- mystring.beginreading(begin); mystring.endreading(end); + const prunichar *begin, *end;+ mystring.beginreading(&begin, &end); the frozen string api uses comparator functions instead of a virtual comparator class.
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
listing 5: closing all browser windows var browsers = windowmediator.getenumerator('navigator:browser'); var browser; while (browsers.hasmoreelements()) { browser = browsers.getnext().queryinterface(components.interfaces.nsidomwindowinternal); browser.browsertrytoclosewindow(); } this method returns an overview of the specified window type in the form of an iterator pattern object called nsisimpleenumerator.
Promises - Archive of obsolete content
let iter = new os.file.directoryiterator(dir); yield iter.foreach(entry => { if (!entry.isdir) files.push(entry.path); }); iter.close(); } // read the files as binary blobs and process them.
Search Extension Tutorial (Draft) - Archive of obsolete content
for (let [name, [origvalue, value]] in iterator(savedprefs)) { if (defaultprefs.getcharpref(name) == value) defaultprefs.setcharpref(name, origvalue); } } function install() {} function uninstall() {} changing the default search engine this change comes in two parts: 1) installing a new search engine (and removing it when your extension is disabled), and 2) setting it as a default (and restoring the previous default w...
Index of archived content - Archive of obsolete content
displaying notifications (deprecated) e4x e4x for templating processing xml with e4x e4x tutorial accessing xml children descendants and filters introduction namespaces the global xml object iterator liveconnect liveconnect overview liveconnect reference jsexception jsobject msx emulator (jsmsx) old proxy api parallelarray properly using css and javascript in xhtml documents ...
Documentation for BiDi Mozilla - Archive of obsolete content
a new frame iterator, nsvisualiterator (in nsframetraversal.cpp) provides visual frame navigation capability.
String Rosetta Stone - Archive of obsolete content
find a substring nsstring findinreadable(const nsastring& pattern, nsastring::const_iterator start, nsastring::const_iterator end, nsstringcomparator& acomparator = nsdefaultstringcomparator()) std::string size_type find(const basic_string& s, size_type pos = 0) const size_type find(const chart* s, size_type pos, size_type n) const size_type find(const chart* s, size_type pos = 0) const size_type find(chart c, size_type pos = 0) const qstring int qstring::indexof ( const qstring & str, int from = 0, qt::casesensitivity cs = qt::casesensitive ) const format a printf style string nsstring appendprintf() std::string n/a qstring qstring & qstring::sprintf ( const char * cformat, ...
Table Cellmap - Archive of obsolete content
and finally the line iterator methods which are used for arrow navigation through a table.
Treehydra Manual - Archive of obsolete content
require({ after_gcc_pass: "cfg" }); include('gcc_util.js'); // for function_decl_cfg include('gcc_print.js'); function process_tree(fn) { print("function " + decl_name(fn)); // fn is a function_decl let cfg = function_decl_cfg(fn); for (let bb in cfg_bb_iterator(cfg)) { print(" basic block " + bb_label(cfg, bb)); for (let isn in bb_isn_iterator(bb)) { print(" " + isn_display(isn)); } } } post-inlining gimple cfgs treehydra can be positioned after any pass, allowing you access various levels of gimple.
Processing XML with E4X - Archive of obsolete content
ccess elements that are within a non-default namespace, first create a namespace object encapsulating the uri for that namespace: var svgns = new namespace('http://www.w3.org/2000/svg'); this can now be used in e4x queries by using namespace::localname in place of a normal element specifier: var svg = xhtml..svgns::svg; alert(svg); // shows the <svg> portion of the document using generators/iterators with e4x as of javascript 1.7, it is possible to use generators and iterators, giving more options for traversing e4x.
Array comprehensions - Archive of obsolete content
the input to an array comprehension does not itself need to be an array; iterators and generators can also be used.
Legacy generator function expression - Archive of obsolete content
description an overview of the usage is available on the iterators and generators page.
Legacy generator function - Archive of obsolete content
description an overview of the usage is available on the iterators and generators page.
New in JavaScript - Archive of obsolete content
includes generators, iterators, array comprehensions, let expressions, and destructuring assignment.
Archived JavaScript Reference - Archive of obsolete content
you can use the more general proxy object instead.reflect.enumerate()the static reflect.enumerate() method used to return an iterator with the enumerable own and inherited properties of the target object, but has been removed in ecmascript 2016 and is deprecated in browsers.string.prototype.quote()the non-standard quote() method returns a copy of the string, replacing various special characters in the string with their escape sequences and wrapping the result in double-quotes (").
OS.File.Info
(as of firefox 38 this attribute is not found, see screen shots below, bugzilla :: bug 1156060) screenshot of info object in variable viewer macosx 10.10.1 ubuntu 14.04.1 windows 8.1 see also os.file.directoryiterator.entry ...
NSS_3.12_release_notes.html
bug 354403: nsslist_createiterator returns pointer to a freed memory if the function fails to allocate a lock bug 399236: pkix wrapper must print debug output into stderr bug 399300: pkix error results not freed after use.
JSAPI User Guide
an access check callback function can use jsdbgapi.h functions such as js_frameiterator and js_stackframeprincipals to obtain the principals of the code that is trying to perform the checked operation.
JSCheckAccessOp
jscheckaccessop implementations generally work by using jsdbgapi functions such as js_frameiterator and js_stackframeprincipals to obtain the principals of the code attempting the checked operation, then examining those principals and comparing them with the system's security policy.
JSFastNative
it also means that applications that use spidermonkey's security features, particularly those that implement jscheckaccessop or jscheckaccessidop in terms of apis such as js_frameiterator and js_stackframeprincipals, must take extra care, as the native function's principals will be missing from the stack.
JSNative
it also means that applications that implement jscheckaccessop or jscheckaccessidop in terms of apis such as js_frameiterator and js_stackframeprincipals, must take extra care, as the native function's principals will be missing from the stack.
JSProtoKey
rangeerror mxr search for jsproto_rangeerror jsproto_referenceerror referenceerror mxr search for jsproto_referenceerror jsproto_syntaxerror syntaxerror mxr search for jsproto_syntaxerror jsproto_typeerror typeerror mxr search for jsproto_typeerror jsproto_urierror urierror mxr search for jsproto_urierror jsproto_iterator iterator mxr search for jsproto_iterator jsproto_stopiteration stopiteration mxr search for jsproto_stopiteration jsproto_arraybuffer arraybuffer mxr search for jsproto_arraybuffer jsproto_int8array int8array mxr search for jsproto_int8array jsproto_uint8array uint8array mxr search for jsproto_uint8array jsproto_...
JS_InitStandardClasses
encodeuricomponent, error, eval, evalerror, function, infinity, isnan, isfinite, math, nan, number, object, parseint, parsefloat, rangeerror, referenceerror, regexp, string, syntaxerror, typeerror, undefined, and urierror as well as a few spidermonkey-specific globals, depending on compile-time options: escape, unescape, uneval, internalerror, script, xml, namespace, qname, file, generator, iterator, and stopiteration, as of spidermonkey 1.7.
JS_NewContext
see also mxr id search for js_newcontext js_destroycontext js_contextiterator js_setcontextcallback ...
JS_ThrowStopIteration
in for…in and for each…in loops, the javascript engine can create an iterator object and call its .next method repeatedly, as described in new in javascript 1.7: iterators.
SpiderMonkey 38
g 1037869) js_getinternedstringcharsandlength (bug 1037869) js_getstringcharsandlength (bug 1037869) js_getstringcharsz (bug 1037869) js_getstringcharszandlength (bug 1037869) js_gettypename (bug 1037718) js_isabouttobefinalized (bug 650161) js_lookupelement (bug 1094176) js_lookupproperty (bug 1094176) js_lookuppropertybyid (bug 1094176) js_lookupucproperty (bug 1094176) js_newpropertyiterator (bug 1081660) js_nextproperty (bug 1081660) js_resolvestub (bug 1103152) js_setfinalizecallback (bug 996785) js_setfunctioncallback (bug 1103269) jschar (bug 1063962) api changes jschar, a typedef for the standard c++ type char16_t, has been removed.
SpiderMonkey 45
js_setcurrentembeddertimefunction (bug 1159507) js_getcurrentembeddertime (bug 1159507) js_mayresolvestandardclass (bug 1155946) js_getiteratorprototype (bug 1225392) js_globallexicalscope (bug 1202902) js_hasextensiblelexicalscope (bug 1202902) js_extensiblelexicalscope (bug 1202902) js_initreflectparse (bug 987514) js::toprimitive (bug 1206168) js::getfirstargumentastypehint (bug 1054756) js::objecttocompletepropertydescriptor (bug 1144366) js_setimmutableprototype (bug 1211607) js_getownucpropertydescriptor (bug 1211607) js_...
Shell global objects
readspsprofilingstack() reads the jit stack using profilingframeiterator.
Redis Tips
so for a test user account creation and verification service called "persona test user," i have these keys: ptu:nextval an iterator ptu:mailq a queue (list) of incoming verification emails ptu:emails:staging a zset of emails being staged, sorted by creation date ptu:emails:valid a zset of email accounts ready for use, sorted by creation date ptu:email:<email>:passwd the password for an email account the ptu: prefix makes it extra clear what these keys are for.
XPCOM hashtable guide
all of these hashtable classes can be iterated over via the iterator class and cleared via the clear method.
Detailed XPCOM hashtable guide
the iterator class will do iteration, but beware that the iteration will occur in a seemingly-random order (no sorting).
XPCOM Interface Reference
tionnsidomxpathexpressionnsidomxpathresultnsidomxulcontrolelementnsidomxulelementnsidomxullabeledcontrolelementnsidomxulselectcontrolelementnsidomxulselectcontrolitemelementnsidatasignatureverifiernsidebugnsidebug2nsidevicemotionnsidevicemotiondatansidevicemotionlistenernsidialogcreatornsidialogparamblocknsidictionarynsidirindexnsidirindexlistenernsidirindexparsernsidirectoryenumeratornsidirectoryiteratornsidirectoryservicensidirectoryserviceprovidernsidirectoryserviceprovider2nsidiskcachestreaminternalnsidispatchsupportnsidocshellnsidocumentloadernsidownloadnsidownloadhistorynsidownloadmanagernsidownloadmanageruinsidownloadobservernsidownloadprogresslistenernsidownloadernsidragdrophandlernsidragservicensidragsessionnsidroppedlinkhandlernsidroppedlinkitemnsidynamiccontainernsieditornsieditorboxobj...
XPCOM Interface Reference by grouping
nsicomponentmanager preferences nsicontentprefobserver nsicontentprefservice nsicomponentregistrar internationalization nsibidikeyboard nsilocale io filesystem nsidirectoryenumerator nsidirectoryiterator nsidirectoryservice nsidirectoryserviceprovider nsidirectoryserviceprovider2 nsidirindex nsidirindexlistener nsidirindexparser nsifile nsilocalfile stream nsiasyncinputstream nsiasyncoutputstream nsiasyncstreamcopier nsibin...
AudioListener.dopplerFactor - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.forwardX - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.forwardY - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.forwardZ - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.positionX - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.positionY - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.positionZ - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.setOrientation() - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.setPosition() - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.speedOfSound - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.upX - Web APIs
WebAPIAudioListenerupX
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.upY - Web APIs
WebAPIAudioListenerupY
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener.upZ - Web APIs
WebAPIAudioListenerupZ
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
AudioListener - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
BaseAudioContext.createPanner() - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
CSSUnparsedValue.forEach() - Web APIs
syntax cssunparsedvalue.foreach(function callback(currentvalue[, index[, array]]) { // your iterator }[, thisarg]); parameters callback the function to execute for each element, taking three arguments: currentvalue the value of the current element being processed.
CSSUnparsedValue.keys() - Web APIs
the cssunparsedvalue.keys() method returns a new array iterator object that contains the keys for each index in the array.
CSSUnparsedValue.values() - Web APIs
the cssunparsedvalue.values() method returns a new array iterator object that contains the values for each index in the cssunparsedvalue object.
CSS Typed Object Model API - Web APIs
cssunparsedvalue.keys() method returning a new array iterator object that contains the keys for each index in the array.
Document.createTreeWalker() - Web APIs
example the following example goes through all nodes in the body, reduces the set of nodes to elements, simply passes through as acceptable each node (it could reduce the set in the acceptnode() method instead), and then makes use of tree walker iterator that is created to advance through the nodes (now all elements) and push them into an array.
Document - Web APIs
WebAPIDocument
document.createnodeiterator() creates a nodeiterator object.
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
*/ function is_all_ws( nod ) { // use ecma-262 edition 3 string and regexp features return !(/[^\t\n\r ]/.test(nod.textcontent)); } /** * determine if a node should be ignored by the iterator functions.
Document Object Model (DOM) - Web APIs
dom interfaces attr cdatasection characterdata childnode comment customevent document documentfragment documenttype domerror domexception domimplementation domstring domtimestamp domstringlist domtokenlist element event eventtarget htmlcollection mutationobserver mutationrecord namednodemap node nodefilter nodeiterator nodelist nondocumenttypechildnode parentnode processinginstruction selection range text textdecoder textencoder timeranges treewalker url window worker xmldocument obsolete dom interfaces the document object model has been highly simplified.
KeyboardLayoutMap.forEach() - Web APIs
syntax keyboardlayoutmap.foreach(function callback(currentvalue[, index[, array]]) { //your iterator }[, thisarg]); parameters callback the function to execute for each element, taking three arguments: currentvalue the value of the current element being processed.
MediaKeyStatusMap.entries() - Web APIs
the entries() read-only property of the mediakeystatusmap interface returns a new iterator object, containing an array of [key, value] pairs for each element in the status map, in insertion order.
NodeList.length - Web APIs
WebAPINodeListlength
it's also commonly used as the iterator in a for loop, as in this example.
PannerNode.distanceModel - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
PannerNode.maxDistance - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
PannerNode.panningModel - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
PannerNode.setOrientation() - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
PannerNode.setPosition() - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
PannerNode.setVelocity() - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
PannerNode - Web APIs
udioctx.currenttime); } else { listener.setorientation(0,0,-1,0,1,0); } var source; var play = document.queryselector('.play'); var stop = document.queryselector('.stop'); var boombox = document.queryselector('.boom-box'); var listenerdata = document.queryselector('.listener-data'); var pannerdata = document.queryselector('.panner-data'); leftbound = (-xpos) + 50; rightbound = xpos - 50; xiterator = width/150; // listener will always be in the same place for this demo if(listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + '...
StylePropertyMapReadOnly.keys() - Web APIs
the stylepropertymapreadonly.keys() method returns a new array iterator containing the keys for each item in stylepropertymapreadonly syntax stylepropertymapreadonly.keys() parameters none.
StylePropertyMapReadOnly.values() - Web APIs
the stylepropertymapreadonly.values() method returns a new array iterator containing the values for each index in the stylepropertymapreadonly object.
XPathResult.iterateNext() - Web APIs
exceptions type_err in case xpathresult.resulttype is not unordered_node_iterator_type or ordered_node_iterator_type, an xpathexception of type type_err is thrown.
XPathResult.snapshotItem() - Web APIs
unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated.
XRInputSourceArray.forEach() - Web APIs
specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that specification.1 working draft xrinputsourcearray interface [1] see iterator-like methods in information contained in a webidl file for information on how an iterable declaration in an interface definition causes entries(), foreach(), keys(), and values() methods to be exposed from objects that implement the interface.
Web APIs
WebAPI
pearray mouseevent mousescrollevent mousewheelevent mutationevent mutationobserver mutationobserverinit mutationrecord n ndefmessage ndefreader ndefreadingevent ndefrecord ndefwriter namelist namednodemap navigationpreloadmanager navigator navigatorconcurrenthardware navigatorid navigatorlanguage navigatoronline navigatorplugins navigatorstorage networkinformation node nodefilter nodeiterator nodelist nondocumenttypechildnode notation notification notificationaction notificationevent notifyaudioavailableevent o oes_element_index_uint oes_fbo_render_mipmap oes_standard_derivatives oes_texture_float oes_texture_float_linear oes_texture_half_float oes_texture_half_float_linear oes_vertex_array_object ovr_multiview2 offlineaudiocompletionevent offlineaudiocontext offscreencanvas ...
Regular expressions - JavaScript
matchall() returns an iterator containing all of the matches, including capturing groups.
JavaScript Guide - JavaScript
ndexed collections arrays typed arrays keyed collections map weakmap set weakset working with objects objects and properties creating objects defining methods getter and setter details of the object model prototype-based oop creating object hierarchies inheritance promises guarantees chaining error propagation composition timing iterators and generators iterators iterables generators meta programming proxy handlers and traps revocable proxy reflect javascript modules exporting importing default exports renaming features aggregating modules dynamic module loading next » ...
The arguments object - JavaScript
arguments[@@iterator] returns a new array iterator object that contains the values for each index in arguments.
GeneratorFunction - JavaScript
examples creating a generator function from a generatorfunction() constructor var generatorfunction = object.getprototypeof(function*(){}).constructor var g = new generatorfunction('a', 'yield a * 2'); var iterator = g(10); console.log(iterator.next().value); // 20 specifications specification ecmascript (ecma-262)the definition of 'generatorfunction' in that specification.
Object.fromEntries() - JavaScript
the iterable argument is expected to be an object that implements an @@iterator method, that returns an iterator object, that produces a two element array-like object, whose first element is a value that will be used as a property key, and whose second element is the value to associate with that property key.
String length - JavaScript
unicode since `length` counts code units instead of characters, if you want to get the number of characters you need something like this: function getcharacterlength (str) { // the string iterator that is used here iterates over characters, // not mere code units return [...str].length; } console.log(getcharacterlength('a\ud87e\udc04z')); // 3 // while not recommended, you could add this to each string as follows: object.defineproperty(string.prototype, 'charlength', { get () { return getcharacterlength(this); } }); console.log('a\ud87e\udc04z'.charlength); // 3 examples...
Symbol.prototype.description - JavaScript
examples using description symbol('desc').tostring(); // "symbol(desc)" symbol('desc').description; // "desc" symbol('').description; // "" symbol().description; // undefined // well-known symbols symbol.iterator.tostring(); // "symbol(symbol.iterator)" symbol.iterator.description; // "symbol.iterator" // global symbols symbol.for('foo').tostring(); // "symbol(foo)" symbol.for('foo').description; // "foo" specifications specification ecmascript (ecma-262)the definition of 'get symbol.prototype.description' in that specification.
Symbol.keyFor() - JavaScript
examples using keyfor var globalsym = symbol.for('foo'); // create a new global symbol symbol.keyfor(globalsym); // "foo" var localsym = symbol(); symbol.keyfor(localsym); // undefined // well-known symbols are not symbols registered // in the global symbol registry symbol.keyfor(symbol.iterator) // undefined specifications specification ecmascript (ecma-262)the definition of 'symbol.keyfor' in that specification.
Symbol.matchAll - JavaScript
the symbol.matchall well-known symbol returns an iterator, that yields matches of the regular expression against a string.
Symbol.prototype.toString() - JavaScript
no string concatenation while you can call tostring() on symbols, you cannot use string concatenation with them: symbol('foo') + 'bar' // typeerror: can't convert symbol to string examples using tostring symbol('desc').tostring() // "symbol(desc)" // well-known symbols symbol.iterator.tostring() // "symbol(symbol.iterator) // global symbols symbol.for('foo').tostring() // "symbol(foo)" specifications specification ecmascript (ecma-262)the definition of 'symbol.prototype.tostring' in that specification.
in operator - JavaScript
// arrays let trees = ['redwood', 'bay', 'cedar', 'oak', 'maple'] 0 in trees // returns true 3 in trees // returns true 6 in trees // returns false 'bay' in trees // returns false (you must specify the index number, not the value at that index) 'length' in trees // returns true (length is an array property) symbol.iterator in trees // returns true (arrays are iterable, works only in es2015+) // predefined objects 'pi' in math // returns true // custom objects let mycar = {make: 'honda', model: 'accord', year: 1998} 'make' in mycar // returns true 'model' in mycar // returns true you must specify an object on the right side of the in operator.
typeof - JavaScript
(logical not) operator are equivalent to boolean() // symbols typeof symbol() === 'symbol' typeof symbol('foo') === 'symbol' typeof symbol.iterator === 'symbol' // undefined typeof undefined === 'undefined'; typeof declaredbutundefinedvariable === 'undefined'; typeof undeclaredvariable === 'undefined'; // objects typeof {a: 1} === 'object'; // use array.isarray or object.prototype.tostring.call // to differentiate regular objects from arrays typeof [1, 2, 4] === 'object'; typeof new date() === 'object'; typeof /regex/ === 'object'; // ...
XPath snippets - XPath
it avoids the more complex syntax of document.evaluate() for cases when it is not required as well as the need to use the special iterators on xpathresult (by returning an array instead).