Created
January 22, 2013 15:25
-
-
Save timbjames/4595461 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
| var run1 = (function () { | |
| "use strict"; | |
| return { | |
| after: function (milliseconds, action) { | |
| setTimeout(action, milliseconds); | |
| }, | |
| every: function (milliseconds, action) { | |
| setInterval(action,milliseconds); | |
| } | |
| }; | |
| }()); | |
| console.log(run1); | |
| var run2 = function () { | |
| var self = this; | |
| self.after = function (milliseconds, action) { | |
| setTimeout(action, milliseconds); | |
| }; | |
| self.every = function (milliseconds, action) { | |
| setInterval(action, milliseconds); | |
| } | |
| }; | |
| console.log(run2); | |
| (function (window, $) { | |
| var run3 = function () { | |
| }; | |
| run3.prototype.after = function (milliseconds, action) { | |
| setTimeout(action, milliseconds); | |
| }; | |
| run3.prototype.every = function (milliseconds, action) { | |
| setInterval(action, milliseconds); | |
| }; | |
| window.Run3 = run3; | |
| })(window, jQuery); | |
| var runInstance = new Run3(); | |
| console.log(runInstance); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment