awa
This commit is contained in:
29
_internal/editor/esm/vs/base/common/stopwatch.js
Normal file
29
_internal/editor/esm/vs/base/common/stopwatch.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
const performanceNow = globalThis.performance.now.bind(globalThis.performance);
|
||||
export class StopWatch {
|
||||
static create(highResolution) {
|
||||
return new StopWatch(highResolution);
|
||||
}
|
||||
constructor(highResolution) {
|
||||
this._now = highResolution === false ? Date.now : performanceNow;
|
||||
this._startTime = this._now();
|
||||
this._stopTime = -1;
|
||||
}
|
||||
stop() {
|
||||
this._stopTime = this._now();
|
||||
}
|
||||
reset() {
|
||||
this._startTime = this._now();
|
||||
this._stopTime = -1;
|
||||
}
|
||||
elapsed() {
|
||||
if (this._stopTime !== -1) {
|
||||
return this._stopTime - this._startTime;
|
||||
}
|
||||
return this._now() - this._startTime;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=stopwatch.js.map
|
||||
Reference in New Issue
Block a user