You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
4.0 KiB
11 lines
4.0 KiB
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.iter.Iterator</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Class goog.iter.Iterator.<code class="type"><VALUE></code></h1><a class="source" href="source/lib/goog/iter/iter.js.src.html#l65">code »</a></header><section><p>Class/interface for iterators. An iterator needs to implement a <code >next</code>
|
|
method and it needs to throw a <code >goog.iter.StopIteration</code> when the
|
|
iteration passes beyond the end. Iterators have no <code >hasNext</code> method.
|
|
It is recommended to always use the helper functions to iterate over the
|
|
iterator or in case you are only targeting JavaScript 1.7 for in loops.<h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">goog.iter.Iterator <span class="args">( )</span></span></div></div></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="instance-methods"><h2>Instance Methods</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l88">code »</a><span class="member"><a name="__iterator__">__iterator__</a> <span class="args">( opt_keys )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a>.<VALUE></code></span></div><p>Returns the <code >Iterator</code> object itself. This is used to implement
|
|
the iterator protocol in JavaScript 1.7</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_keys: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>Whether to return the keys or values. Default is
|
|
to only return the values. This is being used by the for-in loop (true)
|
|
and the for-each-in loop (false). Even though the param gives a hint
|
|
about what the iterator will return there is no guarantee that it will
|
|
return the keys when true is passed.</dl><tr><th>Returns<tr><td><dl>The object itself.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l73">code »</a><span class="member"><a name="next">next</a> <span class="args">( )</span> ⇒ <code class="type">VALUE</code></span></div><p>Returns the next value of the iteration. This will throw the object
|
|
goog.iter#StopIteration when the iteration passes the end.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Any object or value.</dl></table></div></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>No data</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>No data</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>No data</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script> |