Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Keep prototype

  • Loading branch information...
commit bf44f4e249657c7f4e0ed8c80696d89dba0228b7 1 parent dba4d12
@schickling authored
Showing with 5 additions and 3 deletions.
  1. +2 −1  src/timemachine.js
  2. +2 −1  timemachine.js
  3. +1 −1  timemachine.min.js
View
3  src/timemachine.js
@@ -22,7 +22,6 @@
apply: function () {
var self = this;
- Date.prototype = OriginalDate.prototype;
Date = function () {
if (arguments.length === 1) {
return new OriginalDate(arguments[0]);
@@ -32,6 +31,7 @@
return new OriginalDate(self.dateString);
}
};
+ Date.prototype = OriginalDate.prototype;
Date.now = function () {
var date = new OriginalDate(self.dateString);
return date.getTime();
@@ -45,6 +45,7 @@
reset: function() {
Date = OriginalDate;
+ Date.prototype = OriginalDate.prototype;
}
};
View
3  timemachine.js
@@ -22,7 +22,6 @@
apply: function () {
var self = this;
- Date.prototype = OriginalDate.prototype;
Date = function () {
if (arguments.length === 1) {
return new OriginalDate(arguments[0]);
@@ -32,6 +31,7 @@
return new OriginalDate(self.dateString);
}
};
+ Date.prototype = OriginalDate.prototype;
Date.now = function () {
var date = new OriginalDate(self.dateString);
return date.getTime();
@@ -45,6 +45,7 @@
reset: function() {
Date = OriginalDate;
+ Date.prototype = OriginalDate.prototype;
}
};
View
2  timemachine.min.js
@@ -1 +1 @@
-!function(a,b){if("function"==typeof define)define(b);else if("undefined"!=typeof module&&module.exports)module.exports=b();else{var c=b(),d=this,e=d[a];c.noConflict=function(){return d[a]=e,c},d[a]=c}}("timemachine",function(){var a=Date,b={dateString:"Wed Dec 25 1991 13:12:59 GMT",apply:function(){var b=this;Date.prototype=a.prototype,Date=function(){return 1===arguments.length?new a(arguments[0]):7===arguments.length?new a(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]):new a(b.dateString)},Date.now=function(){var c=new a(b.dateString);return c.getTime()}},config:function(a){this.dateString=a.dateString||this.dateString,this.apply()},reset:function(){Date=a}};return b.apply(),b});
+!function(a,b){if("function"==typeof define)define(b);else if("undefined"!=typeof module&&module.exports)module.exports=b();else{var c=b(),d=this,e=d[a];c.noConflict=function(){return d[a]=e,c},d[a]=c}}("timemachine",function(){var a=Date,b={dateString:"Wed Dec 25 1991 13:12:59 GMT",apply:function(){var b=this;Date=function(){return 1===arguments.length?new a(arguments[0]):7===arguments.length?new a(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]):new a(b.dateString)},Date.prototype=a.prototype,Date.now=function(){var c=new a(b.dateString);return c.getTime()}},config:function(a){this.dateString=a.dateString||this.dateString,this.apply()},reset:function(){Date=a,Date.prototype=a.prototype}};return b.apply(),b});
Please sign in to comment.
Something went wrong with that request. Please try again.