Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/engine/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,22 @@ class Runtime extends EventEmitter {
return 'RUNTIME_DISPOSED';
}

/**
* Event name when _step() has been called.
* @const {string}
*/
static get RUNTIME_STEP_START () {
return 'RUNTIME_STEP_START';
}

/**
* Event name when _step() has finished all processing within the function.
* @const {string}
*/
static get RUNTIME_STEP_END () {
return 'RUNTIME_STEP_END';
}

/**
* Event name for reporting that a block was updated and needs to be rerendered.
* @const {string}
Expand Down Expand Up @@ -2563,6 +2579,11 @@ class Runtime extends EventEmitter {
* inactive threads after each iteration.
*/
_step () {
// RUNTIME_STEP_START runs before BEFORE_EXECUTE
// this runs before any processing of this new step
this.frameLoop._stepCounter++;
this.emit(Runtime.RUNTIME_STEP_START);

if (this.interpolationEnabled) {
interpolate.setupInitialState(this);
}
Expand Down Expand Up @@ -2646,6 +2667,9 @@ class Runtime extends EventEmitter {
if (this.interpolationEnabled) {
this._lastStepTime = Date.now();
}

// RUNTIME_STEP_END runs after AFTER_EXECUTE
this.emit(Runtime.RUNTIME_STEP_END);
}

/**
Expand Down
Loading