UIEvent.instanceOf method
UIEvent › instanceOf
Official
Cross-window capable instanceof check, a drop-in replacement for instanceof checks on UIEvents.Signature:
instanceOf(type: UIEventConstructor<T>): this is TParameters:
| Parameter | Type | Description |
|---|---|---|
| type | UIEventConstructor<T> | The type to check. |
Returns: this is T — Whether the event is an instance of the type.
Example:
if (event.instanceOf(MouseEvent)) { console.log('event is a mouse event');}