Skip to content

Instantly share code, notes, and snippets.

@timbjames
Created January 22, 2013 15:25
Show Gist options
  • Select an option

  • Save timbjames/4595461 to your computer and use it in GitHub Desktop.

Select an option

Save timbjames/4595461 to your computer and use it in GitHub Desktop.
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