Created
April 13, 2010 00:10
-
-
Save coolaj86/364151 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Crockford's Later method | |
| // Act III: Function the Ultimate | |
| // http://yuiblog.com/crockford | |
| if (typeof Object.prototype.later !== 'function') { | |
| Object.prototype.later = function (msec, method) { | |
| var that = this, | |
| args = Array.prototype.slice | |
| .apply(arguments, [2]); | |
| if (typeof method === 'string') { | |
| method = that[method]; | |
| } | |
| setTimeout(function () { | |
| method.apply(that, args); | |
| }, msec); | |
| return that; // Cascade | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment