From 60c1021cf03d41e573ea7d2169ba91f6b8e543aa Mon Sep 17 00:00:00 2001 From: zepumph Date: Fri, 22 Feb 2019 15:54:31 -0900 Subject: [PATCH] rename Emitter's argumentTypes -> validators, https://github.com/phetsims/axon/issues/212 --- js/input/Input.js | 42 +++++++++++++++++------------------ js/input/SimpleDragHandler.js | 6 ++--- js/listeners/DragListener.js | 2 +- js/listeners/PressListener.js | 4 ++-- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/js/input/Input.js b/js/input/Input.js index 742105a7a..2883d63a8 100644 --- a/js/input/Input.js +++ b/js/input/Input.js @@ -243,7 +243,7 @@ define( require => { tandem: options.tandem.createTandem( 'mouseUpEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'point', type: Vector2IO }, { name: 'event', type: DOMEventIO } @@ -263,7 +263,7 @@ define( require => { tandem: options.tandem.createTandem( 'mouseDownEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'point', type: Vector2IO }, { name: 'event', type: DOMEventIO } @@ -283,7 +283,7 @@ define( require => { tandem: options.tandem.createTandem( 'mouseMovedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'point', type: Vector2IO }, { name: 'event', type: DOMEventIO } @@ -304,7 +304,7 @@ define( require => { tandem: options.tandem.createTandem( 'mouseOverEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'point', type: Vector2IO }, { name: 'event', type: DOMEventIO } @@ -324,7 +324,7 @@ define( require => { tandem: options.tandem.createTandem( 'mouseOutEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'point', type: Vector2IO }, { name: 'event', type: DOMEventIO } @@ -344,7 +344,7 @@ define( require => { tandem: options.tandem.createTandem( 'wheelScrolledEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: window.Event } ], + validators: [ { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'event', type: DOMEventIO } ] ), @@ -370,7 +370,7 @@ define( require => { tandem: options.tandem.createTandem( 'touchStartedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'id', type: NumberIO }, { name: 'point', type: Vector2IO }, @@ -391,7 +391,7 @@ define( require => { tandem: options.tandem.createTandem( 'touchEndedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'id', type: NumberIO }, { name: 'point', type: Vector2IO }, @@ -415,7 +415,7 @@ define( require => { tandem: options.tandem.createTandem( 'touchMovedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'id', type: NumberIO }, { name: 'point', type: Vector2IO }, @@ -439,7 +439,7 @@ define( require => { tandem: options.tandem.createTandem( 'touchCanceledEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'id', type: NumberIO }, { name: 'point', type: Vector2IO }, @@ -463,7 +463,7 @@ define( require => { tandem: options.tandem.createTandem( 'penStartedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'id', type: NumberIO }, { name: 'point', type: Vector2IO }, @@ -484,7 +484,7 @@ define( require => { tandem: options.tandem.createTandem( 'penEndedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'id', type: NumberIO }, { name: 'point', type: Vector2IO }, @@ -508,7 +508,7 @@ define( require => { tandem: options.tandem.createTandem( 'penMovedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'id', type: NumberIO }, { name: 'point', type: Vector2IO }, @@ -532,7 +532,7 @@ define( require => { tandem: options.tandem.createTandem( 'penCanceledEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], + validators: [ { valueType: 'number' }, { valueType: Vector2 }, { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'id', type: NumberIO }, { name: 'point', type: Vector2IO }, @@ -583,7 +583,7 @@ define( require => { tandem: options.tandem.createTandem( 'focusinEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: window.Event } ], + validators: [ { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'event', type: DOMEventIO } ] ), @@ -618,7 +618,7 @@ define( require => { tandem: options.tandem.createTandem( 'focusoutEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: window.Event } ], + validators: [ { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'event', type: DOMEventIO } ] ), @@ -675,7 +675,7 @@ define( require => { tandem: options.tandem.createTandem( 'clickEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: window.Event } ], + validators: [ { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'event', type: DOMEventIO } ] ), @@ -699,7 +699,7 @@ define( require => { tandem: options.tandem.createTandem( 'inputEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: window.Event } ], + validators: [ { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'event', type: DOMEventIO } ] ), @@ -723,7 +723,7 @@ define( require => { tandem: options.tandem.createTandem( 'changeEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: window.Event } ], + validators: [ { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'event', type: DOMEventIO } ] ), @@ -747,7 +747,7 @@ define( require => { tandem: options.tandem.createTandem( 'keydownEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: window.Event } ], + validators: [ { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'event', type: DOMEventIO } ] ), @@ -771,7 +771,7 @@ define( require => { tandem: options.tandem.createTandem( 'keyupEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: window.Event } ], + validators: [ { valueType: window.Event } ], phetioType: EmitterIO( [ { name: 'event', type: DOMEventIO } ] ), diff --git a/js/input/SimpleDragHandler.js b/js/input/SimpleDragHandler.js index 054d07514..3051071fc 100644 --- a/js/input/SimpleDragHandler.js +++ b/js/input/SimpleDragHandler.js @@ -96,7 +96,7 @@ define( function( require ) { tandem: options.tandem.createTandem( 'dragStartedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ { valueType: Vector2 }, { isValidValue: function( value ) { return value === null || value instanceof Event; } } ], + validators: [ { valueType: Vector2 }, { isValidValue: function( value ) { return value === null || value instanceof Event; } } ], phetioType: EmitterIO( [ { name: 'point', type: Vector2IO, documentation: 'the position of the drag start in view coordinates' }, { name: 'event', type: VoidIO, documentation: 'the scenery pointer Event' } ] ), @@ -137,7 +137,7 @@ define( function( require ) { tandem: options.tandem.createTandem( 'draggedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ + validators: [ { valueType: Vector2 }, { isValidValue: function( value ) { return value === null || value instanceof Event; } } ], @@ -193,7 +193,7 @@ define( function( require ) { tandem: options.tandem.createTandem( 'dragEndedEmitter' ), // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ + validators: [ { valueType: Vector2 }, { isValidValue: function( value ) { diff --git a/js/listeners/DragListener.js b/js/listeners/DragListener.js index 304f22786..9133d8dd9 100644 --- a/js/listeners/DragListener.js +++ b/js/listeners/DragListener.js @@ -193,7 +193,7 @@ define( function( require ) { phetioReadOnly: options.phetioReadOnly, phetioEventType: PhetioObject.EventType.USER, - argumentTypes: [ { valueType: Event } ], + validators: [ { valueType: Event } ], phetioType: DraggedEmitterIO, first: function( event ) { diff --git a/js/listeners/PressListener.js b/js/listeners/PressListener.js index de7ce2766..87e639dc1 100644 --- a/js/listeners/PressListener.js +++ b/js/listeners/PressListener.js @@ -227,7 +227,7 @@ define( function( require ) { phetioEventType: PhetioObject.EventType.USER, // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ + validators: [ { valueType: Event }, { isValidValue: function( v ) { return v === null || v instanceof Node; } }, { isValidValue: function( v ) { return v === null || typeof v === 'function'; } } @@ -248,7 +248,7 @@ define( function( require ) { phetioEventType: PhetioObject.EventType.USER, // TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194 - argumentTypes: [ + validators: [ { isValidValue: v => v instanceof Event || v === null }, { isValidValue: function( v ) { return v === null || typeof v === 'function'; } } ],