DelayedMutate¶
Overview¶
A mixin that delays the mutation of a certain set of mutation keys until AFTER the super() call has fully finished. This can be wrapped around a type where a mutate( { someKey: ... } ) would cause an error in the super(), and we want to postpone that until after construction. e.g.:
const SomeNode = DelayedMutate( 'SomeNode', [ 'someOption' ], class extends SuperNode { constructor( options ) { super( options );
this.someOptionProperty = new Property( something );
}
set someOption( value: Something ) { this.someOptionProperty.value = value; }
get someOption(): Something { return this.someOptionProperty.value; } } );
If this was NOT done, the following would error out:
new SomeNode( { someOption: something } )
@author Jonathan Olson <jonathan.olson@colorado.edu>
Source Code¶
See the source for DelayedMutate.ts in the scenery repository.