mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-13 23:10:56 -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}
|
* @type {?Thread}
|
||||||
*/
|
*/
|
||||||
this.thread = thread;
|
this.thread = thread;
|
||||||
|
|
||||||
|
this._nowObj = {
|
||||||
|
now: () => this.runtime.currentMSecs
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,9 +50,7 @@ class BlockUtility {
|
||||||
*/
|
*/
|
||||||
get nowObj () {
|
get nowObj () {
|
||||||
if (this.runtime) {
|
if (this.runtime) {
|
||||||
return {
|
return this._nowObj;
|
||||||
now: () => this.runtime.currentMSecs
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue