Skip to content

Commit

Permalink
[breaking] Use native Date.now()
Browse files Browse the repository at this point in the history
Ember doesn't support IE < 9 anymore.
  • Loading branch information
tricknotes committed Feb 2, 2016
1 parent 22a4df3 commit 3164299
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 4 additions & 5 deletions lib/backburner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import {
isFunction,
isNumber,
isCoercableNumber,
wrapInTryCatch,
now
wrapInTryCatch
} from './backburner/utils';

import platform from './backburner/platform';
Expand Down Expand Up @@ -369,7 +368,7 @@ Backburner.prototype = {
}
}

var executeAt = now() + parseInt(wait, 10);
var executeAt = Date.now() + parseInt(wait, 10);

if (isString(method)) {
method = target[method];
Expand Down Expand Up @@ -576,7 +575,7 @@ Backburner.prototype = {
},

_scheduleExpiredTimers: function () {
var n = now();
var n = Date.now();
var timers = this._timers;
var i = 0;
var l = timers.length;
Expand Down Expand Up @@ -611,7 +610,7 @@ Backburner.prototype = {
return;
}
var minExpiresAt = this._timers[0];
var n = now();
var n = Date.now();
var wait = Math.max(0, minExpiresAt - n);
this._timerTimeoutId = setTimeout(this._boundRunExpiredTimers, wait);
}
Expand Down
4 changes: 0 additions & 4 deletions lib/backburner/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export function each(collection, callback) {
}
}

// Date.now is not available in browsers < IE9
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
export var now = Date.now || function() { return new Date().getTime(); };

export function isString(suspect) {
return typeof suspect === 'string';
}
Expand Down

0 comments on commit 3164299

Please sign in to comment.