aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/core/shim/immediate.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-02 18:04:37 -0800
committerJose Antonio Marquez2012-02-02 18:04:37 -0800
commit7959d2ecc6e8b1799307de1ceab1112b8ab58e8d (patch)
treece4e32578e1af4d49b8375933a6b7edd0a095b0f /node_modules/montage/core/shim/immediate.js
parent83ac41dd75ec551cdb03252e0bf3081182517d05 (diff)
parentc630ead20487c3948fa36448d3e7d5f7b5cba782 (diff)
downloadninja-7959d2ecc6e8b1799307de1ceab1112b8ab58e8d.tar.gz
Merge branch 'refs/heads/NinjaInternal' into Color
Conflicts: js/controllers/elements/shapes-controller.js js/data/pi/pi-data.js js/panels/properties/content.reel/content.js
Diffstat (limited to 'node_modules/montage/core/shim/immediate.js')
-rw-r--r--node_modules/montage/core/shim/immediate.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/node_modules/montage/core/shim/immediate.js b/node_modules/montage/core/shim/immediate.js
new file mode 100644
index 00000000..3ac48f31
--- /dev/null
+++ b/node_modules/montage/core/shim/immediate.js
@@ -0,0 +1,57 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7/**
8 [setImmediate()]{@link setImmediate}
9 and [clearImmediate()]{@link clearImmediate} shim functions.
10 @see setImmediate
11 @see clearImmediate
12 @module montage/core/shim/immediate
13*/
14
15/**
16 @function
17 @name setImmediate
18 @global
19*/
20
21/**
22 @function
23 @name clearImmediate
24 @global
25*/
26
27(function (global) {
28
29var nextTick = require("../next-tick").nextTick;
30
31if (typeof setImmediate === "undefined") {
32
33 var nextHandle = 0;
34 var handles = {};
35
36 global.setImmediate = function setImmediate(callback) {
37 var handle = nextHandle++;
38 var args = arguments.length > 1 ?
39 Array.prototype.slice.call(arguments, 1) :
40 void 0;
41 handles[handle] = true;
42 nextTick(function () {
43 if (handles[handle]) {
44 callback.apply(void 0, args);
45 delete handles[handle];
46 }
47 });
48 return handle;
49 };
50
51 global.clearImmediate = function clearImmediate(handle) {
52 delete handles[handle];
53 };
54
55}
56
57})(typeof global === "undefined" ? window : global);