Skip to content

Commit

Permalink
Keep prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
schickling committed Sep 27, 2013
1 parent dba4d12 commit bf44f4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/timemachine.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


apply: function () { apply: function () {
var self = this; var self = this;
Date.prototype = OriginalDate.prototype;
Date = function () { Date = function () {
if (arguments.length === 1) { if (arguments.length === 1) {
return new OriginalDate(arguments[0]); return new OriginalDate(arguments[0]);
Expand All @@ -32,6 +31,7 @@
return new OriginalDate(self.dateString); return new OriginalDate(self.dateString);
} }
}; };
Date.prototype = OriginalDate.prototype;
Date.now = function () { Date.now = function () {
var date = new OriginalDate(self.dateString); var date = new OriginalDate(self.dateString);
return date.getTime(); return date.getTime();
Expand All @@ -45,6 +45,7 @@


reset: function() { reset: function() {
Date = OriginalDate; Date = OriginalDate;
Date.prototype = OriginalDate.prototype;
} }


}; };
Expand Down
3 changes: 2 additions & 1 deletion timemachine.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


apply: function () { apply: function () {
var self = this; var self = this;
Date.prototype = OriginalDate.prototype;
Date = function () { Date = function () {
if (arguments.length === 1) { if (arguments.length === 1) {
return new OriginalDate(arguments[0]); return new OriginalDate(arguments[0]);
Expand All @@ -32,6 +31,7 @@
return new OriginalDate(self.dateString); return new OriginalDate(self.dateString);
} }
}; };
Date.prototype = OriginalDate.prototype;
Date.now = function () { Date.now = function () {
var date = new OriginalDate(self.dateString); var date = new OriginalDate(self.dateString);
return date.getTime(); return date.getTime();
Expand All @@ -45,6 +45,7 @@


reset: function() { reset: function() {
Date = OriginalDate; Date = OriginalDate;
Date.prototype = OriginalDate.prototype;
} }


}; };
Expand Down
2 changes: 1 addition & 1 deletion timemachine.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf44f4e

Please sign in to comment.