Skip to content

Instantly share code, notes, and snippets.

@eduardo-matos
Created August 26, 2013 16:40
Show Gist options
  • Select an option

  • Save eduardo-matos/6343599 to your computer and use it in GitHub Desktop.

Select an option

Save eduardo-matos/6343599 to your computer and use it in GitHub Desktop.
Infinite iterator in Dojo
define('InfiniteIterator', [
'dojox/collections/_base',
'dojo/_base/lang'
], function (
dxc,
lang
) {
'use strict';
function InfiniteIterator(array) {
var rawIterator = new dxc.Iterator(array);
var customIterator = lang.delegate(this, rawIterator);
customIterator.get = function () {
this.atEnd()? this.reset(): '';
return rawIterator.get(arguments);
}
return customIterator;
}
return InfiniteIterator;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment