зеркало из https://github.com/mozilla/fxa.git
fix(content): Make sure startTime is an integer
Because: - Some devices may report performance.timeOrigin as a float instead of an int This Commit: - Converts performance.timeOrigin value to to an int
This commit is contained in:
Родитель
5a8e032a05
Коммит
a49354bd6a
|
@ -5,17 +5,17 @@
|
|||
class Timers {
|
||||
init(options) {
|
||||
if (!options || !options.performance) {
|
||||
throw new Error('options.performance required')
|
||||
throw new Error('options.performance required');
|
||||
}
|
||||
|
||||
this.completed = {};
|
||||
this.running = {};
|
||||
this.performance = options.performance;
|
||||
this.baseTime = options.performance.timeOrigin;
|
||||
this.baseTime = parseInt(options.performance.timeOrigin);
|
||||
}
|
||||
|
||||
start(name) {
|
||||
var start = this.performance.now()
|
||||
var start = this.performance.now();
|
||||
if (typeof this.running[name] === 'number') {
|
||||
throw new Error(name + ' timer already started');
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class Timers {
|
|||
}
|
||||
|
||||
stop(name) {
|
||||
var stop = this.performance.now()
|
||||
var stop = this.performance.now();
|
||||
|
||||
if (typeof this.running[name] !== 'number') {
|
||||
throw new Error(name + ' timer not started');
|
||||
|
|
Загрузка…
Ссылка в новой задаче