Skip to content

Commit

Permalink
Fix: Event listeners didn't include the selector second parameter op…
Browse files Browse the repository at this point in the history
…tion

https://datatables.net/forums/discussion/77428

Backported from the `2` commit: af08ec9 .
  • Loading branch information
AllanJard committed Oct 25, 2023
1 parent e64f2a4 commit 04ea6b7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions types/types.d.ts
Expand Up @@ -815,6 +815,16 @@ export interface Api<T> {
*/
off(event: string, callback?: ((e: Event, ...args: any[]) => void)): Api<T>;

/**
* Remove event handlers from selected elements
*
* @param event Event name to remove.
* @param selector Element selector
* @param callback Specific callback function to remove if you want to unbind a single event listener.
* @returns DataTables Api instance
*/
off(event: string, selector: string, callback?: ((e: Event, ...args: any[]) => void)): Api<T>;

/**
* Table events listener.
*
Expand All @@ -824,6 +834,16 @@ export interface Api<T> {
*/
on(event: string, callback: ((e: Event, ...args: any[]) => void)): Api<T>;

/**
* Listen for events from selected elements
*
* @param event Event to listen for.
* @param selector Element selector
* @param callback Event handler.
* @returns DataTables Api instance
*/
on(event: string, selector: string, callback: ((e: Event, ...args: any[]) => void)): Api<T>;

/**
* Listen for a table event once and then remove the listener.
*
Expand All @@ -834,6 +854,16 @@ export interface Api<T> {
*/
one(event: string, callback: ((e: Event, ...args: any[]) => void)): Api<T>;

/**
* Listen for events from a selected element and trigger only once then remove the listener.
*
* @param event Event to listen for.
* @param selector Element selector
* @param callback Event handler.
* @returns DataTables Api instance
*/
one(event: string, selector: string, callback: ((e: Event, ...args: any[]) => void)): Api<T>;

/**
* Page Methods / object
*/
Expand Down

0 comments on commit 04ea6b7

Please sign in to comment.