Skip to content

Commit 43fb172

Browse files
committed
linkedin#52: Adding constant
1 parent 9d54d96 commit 43fb172

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/metal/engine.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
import { EngineInterface } from './interfaces';
1313
import W from './window-proxy';
1414

15+
const NUM_SKIPPED_FRAMES = 4;
16+
1517
export class Engine implements EngineInterface {
1618
private reads: Array<Function> = [];
1719
private work: Array<Function> = [];
1820
private running: Boolean = false;
19-
private skipCounter: number = 4;
21+
private skipCounter: number = NUM_SKIPPED_FRAMES;
2022
scheduleRead(callback: Function) {
2123
this.reads.unshift(callback);
2224
this.run();
@@ -29,7 +31,7 @@ export class Engine implements EngineInterface {
2931
if (!this.running) {
3032
this.running = true;
3133
W.rAF(() => {
32-
if (this.skipCounter > 3) {
34+
if (this.skipCounter > NUM_SKIPPED_FRAMES - 1) {
3335
this.skipCounter = 0;
3436
for (let i = 0, rlen = this.reads.length; i < rlen; i++) {
3537
this.reads.pop()();

0 commit comments

Comments
 (0)