Files
DefinitelyTyped/tether-drop/index.d.ts
Péter Kovács f20bfbfba3 [tether-drop] Improve beforeClose function signature (#14145)
beforeClose function in the type definition has no parameters, yet in drop source code (DropInstance class, beforeCloseHandler method) two parameters are passed to this function.
First the JavaScript event object, that triggered the close, and then the drop instance object. The signature was updated to reflect this.
2017-01-20 09:55:59 -08:00

62 lines
1.7 KiB
TypeScript

// Type definitions for Drop v1.4
// Project: http://github.hubspot.com/drop/
// Definitions by: Adi Dahiya <https://github.com/adidahiya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference types="tether" />
import Tether = require("tether");
export = Drop;
export as namespace Drop;
// global Drop constructor
declare class Drop {
constructor(options: Drop.IDropOptions);
public content: HTMLElement;
public tether: Tether;
public open(): void;
public close(): void;
public remove(): void;
public toggle(): void;
public isOpened(): boolean;
public position(): void;
public destroy(): void;
/*
* Drop instances fire "open" and "close" events.
*/
public on(event: string, handler: Function, context?: any): void;
public once(event: string, handler: Function, context?: any): void;
public off(event: string, handler?: Function): void;
public static createContext(options: Drop.IDropContextOptions): typeof Drop;
}
declare namespace Drop {
interface IDropContextOptions {
classPrefix?: string;
defaults?: IDropOptions;
}
interface IDropOptions {
target?: Element;
content?: Element | string | ((drop?: Drop) => string) | ((drop?: Drop) => Element);
position?: string;
openOn?: string;
classes?: string;
constrainToWindow?: boolean;
constrainToScrollParent?: boolean;
remove?: boolean;
beforeClose?: (event: Event, drop: Drop) => boolean;
openDelay?: number;
closeDelay?: number;
focusDelay?: number;
blurDelay?: number;
hoverOpenDelay?: number;
hoverCloseDelay?: number;
tetherOptions?: Tether.ITetherOptions;
}
}