mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-03-14 01:09:51 -04:00
Improve the performance of the timer utilitiy so that it does not garbage collect multiple times per frame.
This commit is contained in:
parent
4b777d94e4
commit
325372233d
1 changed files with 5 additions and 3 deletions
|
@ -21,6 +21,10 @@ class BlockUtility {
|
|||
* @type {?Thread}
|
||||
*/
|
||||
this.thread = thread;
|
||||
|
||||
this._nowObj = {
|
||||
now: () => this.runtime.currentMSecs
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,9 +50,7 @@ class BlockUtility {
|
|||
*/
|
||||
get nowObj () {
|
||||
if (this.runtime) {
|
||||
return {
|
||||
now: () => this.runtime.currentMSecs
|
||||
};
|
||||
return this._nowObj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue