The type of the data parameter that must be passed to the constructor,
and is made available as a data property on the event. If not set, the type is void
and no data property will be set
Specifies if event bubbling is enabled for this event. Defaults to
false.
Specifies if this events supports cancellation. Defaults to
false
If true, stores a timestamp of the construction time on the event.
Defaults to false.
A callback that is used to pass the string event types. See the examples for more info.
Advanced variant of the createEventClass util. Creates an isomorphic event class.
This is an event class where the data property can be different for each event type.
A tuple type containing the types of the data property for
each event type. The order of this tuple corresponds to the order of the type
strings passed
Objects optionally containing the properties bubbles, cancelable
and setTimestamp. The order in which these objects are passed corresponds to the order
of the type strings passed
a callback that is used to pass more parameters. See the example
Generated using TypeDoc
Utility function to generate a class that extends AbstractEvent and optionally has a
dataproperty.For more information on the
bubbles,cancelableandsetTimestampparameters, see AbstractEventThe recommended syntax is to use
createEventClassin anextendsclause:class MyEvents extends createEventClass(true)('START', 'STOP') {}You can also store the result in a
const, but the result then cannot be used as a type within TypeScript:const MyEvent = createEventClass(false, true)('START', 'STOP'); const myEventInstance:MyEvent; // <= not possibleset the generic type parameter to specify a
dataproperty on the event:class MyEvents extends createEventClass<{ id: number }>()('START', 'STOP') {} const myEventInstance = new MyEvent( 'START', // <= must be either 'START' or 'STOP', { id: 4 } // <= must be of type { id: number } );