Class: SC.Enumerator

An object that iterates over all of the values in an object.

An instance of this object is returned every time you call the enumerator() method on an object that implements the SC.Enumerable mixin.

Once you create an enumerator instance, you can call nextObject() on it until you can iterated through the entire collection. Once you have exhausted the enumerator, you can reuse it if you want by calling reset().

Defined in: enumerator.js

Since:
SproutCore 1.0

Class Methods

Instance Methods

Class Method Detail

create(enumerableObject)

Use this method to manually create a new Enumerator object. Usually you will not access this method directly but instead call enumerator() on the item you want to enumerate.

Parameters:
enumerableObject SC.Enumerable
enumerable object.
Returns:
SC.Enumerator
the enumerator

Instance Method Detail

destroy()

Releases the enumerators enumerable object. You cannot use this object anymore. This is not often needed but it is useful when you need to make sure memory gets cleared.

Returns:
Object
null
nextObject()
Returns the next object in the enumeration or undefined when complete.
Returns:
Object
the next object or undefined
reset()

Resets the enumerator to the beginning. This is a nice way to reuse an existing enumerator.

Returns:
Object
this
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)