repo.or.cz
/
chromium-blink-merge.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Disable view source for Developer Tools.
[chromium-blink-merge.git]
/
chrome
/
test
/
data
/
third_party
/
spaceport
/
js
/
util
/
ensureCallback.js
blob
a55a9e7e7958c884f6c93daa846b7ae4896c7b3d
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
});