Last active
August 29, 2015 14:24
-
-
Save jaycliff/37598cb752d4de0ffc33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2015 Jaycliff Arcilla of Eversun Software Philippines Corporation | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
*/ | |
if (typeof window.setImmediate !== "function") { | |
window.setImmediate = (function () { | |
"use strict"; | |
var list_of_args = []; | |
return function (func) { | |
var i, length = arguments.length; | |
if (length === 0) { | |
throw new TypeError("Failed to execute 'setImmediate' on 'Window': 1 argument required, but only 0 present."); | |
} | |
if (length > 1) { | |
list_of_args.length = 0; | |
list_of_args.push(func, 0); | |
for (i = 1; i < length; i += 1) { | |
list_of_args.push(arguments[i]); | |
} | |
i = setTimeout.apply(this, list_of_args); | |
list_of_args.length = 0; | |
return i; | |
} | |
return setTimeout(func, 0); | |
}; | |
}()); | |
window.clearImmediate = function (immediateID) { | |
"use strict"; | |
clearTimeout(immediateID); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment