Every custom event has to be compatible with BaseEvent.
typeMyEvent = { // In `fire<MyEvent>( name )`, `on<MyEvent>( name )`, `once<MyEvent>( name )` and `listenTo<MyEvent>( name )` calls // the `name` argument will be type-checked to ensure it's `'myEvent'` or have `'myEvent:'` prefix. // Required. name: 'myEvent' | `myEvent:${string}`;
// In `fire<MyEvent>( name, a, b )` call, `a` and `b` parameters will be type-checked against `number` and `string`. // In `on<MyEvent>`, `once<MyEvent>` and `listenTo<MyEvent>` calls, the parameters of provided callback function // will be automatically inferred as `EventInfo`, `number` and `string`. // Required. args: [ number, string ];
// `fire<MyEvent>` will have return type `boolean | undefined`. // Optional, unknown by default. return: boolean;
// `fire<MyEvent>( eventInfo )` will type-check that `eventInfo` is `MyEventInfo`, not a base `EventInfo` or string. // In `on<MyEvent>`, `once<MyEvent>` and `listenTo<MyEvent>` calls, the first callback parameter will be of this type. // Optional. eventInfo: MyEventInfo;
// In `on<MyEvent>`, `once<MyEvent>` and `listenTo<MyEvent>` calls, the `options` parameter will be of type // `{ myOption?: boolean; priority?: PriorityString } // Optional. callbackOptions: { myOption?: boolean }; };
Default type describing any event.
Every custom event has to be compatible with
BaseEvent.