4831: Remove old reference to util namespace.
authorTom Clegg <tom@curoverse.com>
Mon, 19 Jan 2015 23:54:38 +0000 (18:54 -0500)
committerTom Clegg <tom@curoverse.com>
Mon, 19 Jan 2015 23:54:38 +0000 (18:54 -0500)
apps/backstage/app/util.js

index 277124fd9ef06726a7fe489ba9561bbe4a103a6a..a856da2fa0ab45e303a16342ced8e2fa3ea7a993 100644 (file)
@@ -3,8 +3,8 @@ module.exports = {
     debounce: debounce,
 };
 
-// util.choose('a', {a: 'A', b: 'B'}) --> return 'A'
-// util.choose('a', {a: [console.log, 'foo']}) --> return console.log('foo')
+// choose('a', {a: 'A', b: 'B'}) --> return 'A'
+// choose('a', {a: [console.log, 'foo']}) --> return console.log('foo')
 function choose(key, options) {
     var option = options[key];
     if (option instanceof Array && option[0] instanceof Function)
@@ -13,13 +13,13 @@ function choose(key, options) {
         return option;
 }
 
-// util.debounce(250, key) --> Return a promise. If someone else
+// debounce(250, key) --> Return a promise. If someone else
 // calls debounce with the same key, reject the promise. If nobody
 // else has done so after 250ms, resolve the promise.
 function debounce(ms, key) {
     var newpending;
-    util.debounce.pending = util.debounce.pending || [];
-    util.debounce.pending.map(function(found) {
+    debounce.pending = debounce.pending || [];
+    debounce.pending.map(function(found) {
         if (!newpending && found.key === key) {
             // Promise already pending with this key. Reject the old
             // one, reuse its slot for the new one.
@@ -32,15 +32,15 @@ function debounce(ms, key) {
     if (!newpending) {
         // No pending promise with this key.
         newpending = {key: key}
-        util.debounce.pending.push(newpending);
+        debounce.pending.push(newpending);
     }
     newpending.deferred = m.deferred();
     m.startComputation();
     newpending.timer = window.setTimeout(function() {
         // Success, no more bouncing. Remove from pending list.
-        util.debounce.pending.map(function(found, i) {
+        debounce.pending.map(function(found, i) {
             if (found === newpending) {
-                util.debounce.pending.splice(i, 1);
+                debounce.pending.splice(i, 1);
                 found.deferred.resolve();
                 m.endComputation();
             }