Skip to content

Commit

Permalink
fix use of Emitter, #405, #455
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jan 20, 2019
1 parent ff337a2 commit 8adb881
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/ComboBoxListBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ define( require => {
const ComboBoxListItemNode = require( 'SUN/ComboBoxListItemNode' );
const Emitter = require( 'AXON/Emitter' );
const EmitterIO = require( 'AXON/EmitterIO' );
const Event = require( 'SCENERY/input/Event' );
const KeyboardUtil = require( 'SCENERY/accessibility/KeyboardUtil' );
const Panel = require( 'SUN/Panel' );
const sun = require( 'SUN/sun' );
Expand Down Expand Up @@ -54,8 +55,7 @@ define( require => {

// TODO sun#405 It seems it would be better to use FireListener on each ComboBoxListItemNode
const firedEmitter = new Emitter( {
tandem: tandem.createTandem( 'firedEmitter' ),
phetioType: EmitterIO( [ { name: 'event', type: VoidIO } ] ), // TODO sun#405 Should this be EventIO or DOMEventIO?
argumentTypes: [ { validValue: Event } ],
listener: event => {

const listItemNode = event.currentTarget;
Expand All @@ -69,7 +69,11 @@ define( require => {
event.abort(); // prevent nodes (eg, controls) behind the list from receiving the event

property.value = listItemNode.item.value;
}
},

// phet-io
tandem: tandem.createTandem( 'firedEmitter' ),
phetioType: EmitterIO( [ { name: 'event', type: VoidIO } ] ) // TODO sun#405 Should this be EventIO or DOMEventIO?
} );

// listener that we'll attach to each item in the list
Expand All @@ -84,7 +88,7 @@ define( require => {
event.abort(); // prevent click-to-dismiss on the list
},
up( event ) {
firedEmitter.emit1( event ); //TODO #405 emit1 is deprecated
firedEmitter.emit( event );
}
};

Expand Down

0 comments on commit 8adb881

Please sign in to comment.