Skip to content

Commit

Permalink
Converted TwoSceneSelectionNode to use Emitter pattern for data nesti…
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Sep 9, 2017
1 parent 7083c47 commit 9f6c643
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions js/Emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ define( function( require ) {
indicateCallbacks: true,
phetioArgumentTypes: [], // {TType[]} - for serializing/displaying the values during emit
tandem: Tandem.tandemOptional(),
phetioEmitData: true // Can be overriden to suppress data from the phet-io data stream. For example, clock tick
// emits would spam the console, but the wrapper may still want to listen for the emits
phetioEmitData: true, // Can be overriden to suppress data from the phet-io data stream. For example, clock tick
// emits would spam the console, but the wrapper may still want to listen for the emits
phetioMessageType: 'model' // 'model' | 'user'
}, options );

assert && assert( options.phetioMessageType === 'model' || options.phetioMessageType === 'user' );

// @public (read-only) {string} - indicate the type of event
this.phetioMessageType = options.phetioMessageType;

var self = this;

// @private - indicates whether data should appear on the data stream.
Expand Down
2 changes: 1 addition & 1 deletion js/TEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ define( function( require ) {
emitter.callbacksStartedEmitter.addListener( function() {
assert && assert( arguments.length === phetioArgumentTypes.length, 'Wrong number of arguments, expected ' + phetioArgumentTypes.length + ', received ' + arguments.length );
var parameters = { arguments: Array.prototype.slice.call( arguments ) };
var messageIndex = phetioEvents.start( 'model', phetioID, TEmitter( phetioArgumentTypes ), 'emitted', parameters );
var messageIndex = phetioEvents.start( emitter.phetioMessageType, phetioID, TEmitter( phetioArgumentTypes ), 'emitted', parameters );

emitter.callbacksEndedEmitter.addListener( function listener() {
assert && assert( arguments.length === 0, 'Wrong number of arguments, expected ' + phetioArgumentTypes.length + ', received ' + arguments.length );
Expand Down

0 comments on commit 9f6c643

Please sign in to comment.