diff --git a/js/types/ObjectIO.js b/js/types/ObjectIO.js index ba8ac316..04358f2c 100644 --- a/js/types/ObjectIO.js +++ b/js/types/ObjectIO.js @@ -285,84 +285,6 @@ ObjectIO.validator = { ObjectIO.validateIOType( ObjectIO ); -/** - * Function that creates an IO Type associated with a core type. Methods are forwarded to the core type. - * @param {function} coreType, e.g., Bunny - * @param {string} typeName, e.g., BunnyIO - * @param {Object} [options] - * @returns {IOType} - * @public - */ -ObjectIO.createIOType = ( coreType, typeName, options ) => { - assert && assert( typeName.endsWith( PhetioConstants.IO_TYPE_SUFFIX ) || typeName.includes( `${PhetioConstants.IO_TYPE_SUFFIX}<` ), 'IO Type name must end with IO' ); - options = merge( { - - // The parent IO Type, which will have standard 'class extends' inheritance, and inherit methods, events, etc. - // and be shown as a parent type in Studio + API docs - parentIOType: ObjectIO, - - // {string} e.g., "Animal that has a genotype (genetic blueprint) and a phenotype (appearance)." - documentation: `IO Type for ${typeName.substring( 0, typeName.length - 2 )}`, - - // {Object} - key/value pairs with methods, see PhetioEngineIO for an example - methods: {}, - - events: [], - parameterTypes: [] - }, options ); - - class IOType extends options.parentIOType { - - /** - * @param {PhetioObject} phetioObject - * @returns {Object} - * @public - * @override - */ - static toStateObject( phetioObject ) { - validate( phetioObject, this.validator ); - return phetioObject.toStateObject(); - } - - // @public - static fromStateObject( stateObject ) { - return coreType.fromStateObject( stateObject ); - } - - /** - * @param {Object} stateObject - * @returns {Object[]} - * @public - * @override - */ - static stateToArgsForConstructor( stateObject ) { - return coreType.stateToArgsForConstructor( stateObject ); - } - - /** - * Restores coreType state after instantiation. - * @param {PhetioObject} phetioObject - * @param {Object} stateObject - * @public - * @override - */ - static applyState( phetioObject, stateObject ) { - validate( phetioObject, this.validator ); - phetioObject.applyState( stateObject ); - } - } - - IOType.documentation = options.documentation; - IOType.validator = { valueType: coreType }; - IOType.typeName = typeName; - IOType.events = options.events; - IOType.parameterTypes = options.parameterTypes; - IOType.methods = options.methods; - ObjectIO.validateIOType( IOType ); - - return IOType; -}; - /** * Fills in the boilerplate for static fields of an IO Type. * @param {function} ioType - an IO Type