Skip to content

Commit

Permalink
Adding the ability to interrupt the Display's listeners, see #218 (co…
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Dec 17, 2019
1 parent dc95452 commit 9032474
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions js/display/Display.js
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,24 @@ define( require => {
},
get inputListeners() { return this.getInputListeners(); },

/**
* Interrupts all input listeners that are attached to this Display.
* @public
*
* @returns {Display} - For chaining
*/
interruptInput: function() {
const listenersCopy = this.inputListeners;

for ( let i = 0; i < listenersCopy.length; i++ ) {
const listener = listenersCopy[ i ];

listener.interrupt && listener.interrupt();
}

return this;
},

ensureNotPainting: function() {
assert && assert( !this._isPainting,
'This should not be run in the call tree of updateDisplay(). If you see this, it is likely that either the ' +
Expand Down
2 changes: 1 addition & 1 deletion js/nodes/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,7 @@ define( require => {
for ( let i = 0; i < listenersCopy.length; i++ ) {
const listener = listenersCopy[ i ];

listener.interrupt && listener.interrupt(); // TODO: get rid of the event?
listener.interrupt && listener.interrupt();
}

return this;
Expand Down

0 comments on commit 9032474

Please sign in to comment.