Skip to content

Commit

Permalink
Merge pull request #1619 from wurambo/develop
Browse files Browse the repository at this point in the history
fix event handler callback signature
  • Loading branch information
adumesny authored Feb 13, 2021
2 parents 26555e0 + 863a340 commit 98aa68e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/gridstack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { GridStackEngine } from './gridstack-engine';
import { obsoleteOpts, obsoleteAttr, Utils, HeightData } from './utils';
import { GridStackElement, GridItemHTMLElement, GridStackWidget, GridStackNode, GridStackOptions, numberOrString, ColumnOptions } from './types';
import { ColumnOptions, GridItemHTMLElement, GridStackElement, GridStackEventHandlerCallback, GridStackNode, GridStackOptions, GridStackWidget, numberOrString } from './types';
import { GridStackDDI } from './gridstack-ddi';

// export all dependent file as well to make it easier for users to just import the main file
Expand Down Expand Up @@ -828,8 +828,7 @@ export class GridStack {
* grid.el.addEventListener('added', function(event) { log('added ', event.detail)} );
*
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public on(name: GridStackEvent, callback: (event: Event, arg2?: GridItemHTMLElement | GridStackNode[]) => void): GridStack {
public on(name: GridStackEvent, callback: GridStackEventHandlerCallback): GridStack {
// check for array of names being passed instead
if (name.indexOf(' ') !== -1) {
let names = name.split(' ') as GridStackEvent[];
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export interface GridItemHTMLElement extends HTMLElement {

export type GridStackElement = string | HTMLElement | GridItemHTMLElement;

export type GridStackEventHandlerCallback = (event: Event, arg2?: GridItemHTMLElement | GridStackNode | GridStackNode[], newNode?: GridStackNode) => void;

/**
* Defines the options for a Grid
*/
Expand Down

0 comments on commit 98aa68e

Please sign in to comment.