It is a small, general-purpose runtime environment for JavaScript with first-class support for various interfaces, ECMAScript modules, and seamless TypeScript integration.
This class returns any custom data used to create the event. Typically, it is used for synthetic events. It has two main features, constructors and properties.
class CustomEvent<T = any> extends Event
constructor(typeArg: string, eventInitDict?: CustomEventInit<T>)
readonly detail: T
// This refers to data event returned.
// It is typically used for synthetic events.
// T refers to the data type of the custom event passed in the constructor.
interface CustomEventInit<T = any> extends EventInit {
detail?: T;
}
declare class CustomEvent<T = any> extends Event {
constructor(typeArg: string, eventInitDict?: CustomEventInit<T>);
// Returns any custom data event was created with.
// Typically used for synthetic events.
readonly detail: T;
}
Free Resources