Skip to content

Commit 6dd0968

Browse files
committed
src: Clean up.
1 parent 1c78abf commit 6dd0968

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/core/Clock.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { now } from '../utils.js';
2+
13
/**
24
* Class for keeping track of time.
35
*/
@@ -125,10 +127,4 @@ class Clock {
125127

126128
}
127129

128-
function now() {
129-
130-
return performance.now();
131-
132-
}
133-
134130
export { Clock };

src/nodes/core/NodeFrame.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { NodeUpdateType } from './constants.js';
2+
import { now } from '../../utils.js';
23

34
/**
45
* Management class for updating nodes. The module tracks metrics like
@@ -291,11 +292,11 @@ class NodeFrame {
291292

292293
this.frameId ++;
293294

294-
if ( this.lastTime === undefined ) this.lastTime = performance.now();
295+
if ( this.lastTime === undefined ) this.lastTime = now();
295296

296-
this.deltaTime = ( performance.now() - this.lastTime ) / 1000;
297+
this.deltaTime = ( now() - this.lastTime ) / 1000;
297298

298-
this.lastTime = performance.now();
299+
this.lastTime = now();
299300

300301
this.time += this.deltaTime;
301302

src/utils.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,10 @@ function toReversedProjectionMatrix( projectionMatrix ) {
149149

150150
}
151151

152-
export { arrayMin, arrayMax, arrayNeedsUint32, getTypedArray, createElementNS, createCanvasElement, warnOnce, probeAsync, toNormalizedProjectionMatrix, toReversedProjectionMatrix };
152+
function now() {
153+
154+
return performance.now();
155+
156+
}
157+
158+
export { arrayMin, arrayMax, arrayNeedsUint32, getTypedArray, createElementNS, createCanvasElement, warnOnce, probeAsync, toNormalizedProjectionMatrix, toReversedProjectionMatrix, now };

0 commit comments

Comments
 (0)