Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/test/data/third_party/spaceport/js/util/ensureCallback.js

Issue 10154006: Add test data for spaceport benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 define([ ], function () {
2 return function ensureCallback(callback) {
3 if (typeof callback !== 'function') {
4 return function (err) {
5 if (err) {
6 console.error(err);
7 }
8 };
9 }
10
11 var called = false;
12 return function () {
13 if (called) {
14 // Disallow calling multiple times
15 return;
16 }
17
18 called = true;
19 var args = arguments;
20
21 setTimeout(function () {
22 // Ensure async
23 callback.apply(null, args);
24 }, 0);
25 };
26 };
27 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698