docs(core): update comments for on, once, addEventListener and removeEventListener (#10545)

This commit is contained in:
Jamie Birch
2024-05-24 00:26:03 +09:00
committed by GitHub
parent 9be392fbb0
commit 9e472d7874
16 changed files with 167 additions and 89 deletions

View File

@ -87,12 +87,16 @@ export class WebView extends View {
reload();
/**
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
* @param callback - Callback function which will be executed when event is raised.
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
* Adds a listener for the specified event name.
*
* @param eventName The name of the event.
* @param callback The event listener to add. Will be called when an event of
* the given name is raised.
* @param thisArg An optional parameter which, when set, will be bound as the
* `this` context when the callback is called. Falsy values will be not be
* bound.
*/
on(eventNames: string, callback: (data: EventData) => void, thisArg?: any): void;
on(eventName: string, callback: (data: EventData) => void, thisArg?: any): void;
/**
* Raised when a loadFinished event occurs.