Skip to content

Instantly share code, notes, and snippets.

@jbest84
Created March 10, 2012 21:27
Show Gist options
  • Save jbest84/2013302 to your computer and use it in GitHub Desktop.
Save jbest84/2013302 to your computer and use it in GitHub Desktop.
Mock a slow connection
define([
"dojo/data/ItemFileReadStore",
"dojo/_base/declare",
"dojo/_base/lang"
], function (ItemFileReadStore, declare, lang) {
return declare("dojox.grid.tests.support.SlowItemFileReadStore", ItemFileReadStore, {
delay: 1000, // delay in milliseconds for each fetch
constructor: function (options) {
if (options) {
this.delay = options.delay > 0 ? options.delay : this.delay;
}
this.inherited(arguments);
},
_fetchItems: function () {
window.setTimeout(lang.hitch({self: this, args: arguments}, function() {
this.self.inherited('_fetchItems', this.args);
}), this.delay);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment