|
|
@ -222,13 +222,14 @@
|
|
|
|
return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
|
|
|
|
return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Util.noop = function () {};
|
|
|
|
|
|
|
|
|
|
|
|
/* for wrapping async functions such that they can only be called once */
|
|
|
|
/* for wrapping async functions such that they can only be called once */
|
|
|
|
Util.once = function (f) {
|
|
|
|
Util.once = function (f, g) {
|
|
|
|
var called;
|
|
|
|
|
|
|
|
return function () {
|
|
|
|
return function () {
|
|
|
|
if (called) { return; }
|
|
|
|
if (!f) { return; }
|
|
|
|
called = true;
|
|
|
|
|
|
|
|
f.apply(this, Array.prototype.slice.call(arguments));
|
|
|
|
f.apply(this, Array.prototype.slice.call(arguments));
|
|
|
|
|
|
|
|
f = g;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|