DefinitelyTyped/types/materialize-css/taptarget.d.ts
Max a355d32369 materialize-css: Add missing declarations and tests (#25492)
* Restructure files and add missing declarations

* Add JQuery declarations

* Restructure tests

* Add carousel tests

* Add more tests and missing JQuery declarations

* Add waves declaration and a test

* Add static init methods and tests

* allow jquery and cash object to be passed to init

* Remove redundant reference

* Clean up

* Clean up

* Clean up and add tests

* Clean up and add tests
2018-05-07 11:00:18 -07:00

55 lines
1.3 KiB
TypeScript

/// <reference path="./common.d.ts" />
declare namespace M {
class TapTarget extends Component<TapTargetOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): TapTarget;
/**
* Init TapTarget
*/
static init(els: Element, options?: Partial<TapTargetOptions>): TapTarget;
/**
* Init TapTargets
*/
static init(els: MElements, options?: Partial<TapTargetOptions>): TapTarget[];
/**
* If the tap target is open
*/
isOpen: boolean;
/**
* Open Tap Target
*/
open(): void;
/**
* Close Tap Target
*/
close(): void;
}
interface TapTargetOptions {
/**
* Callback function called when Tap Target is opened
* @default null
*/
onOpen: (this: TapTarget, origin: Element) => void;
/**
* Callback function called when Tap Target is closed
* @default null
*/
onClose: (this: TapTarget, origin: Element) => void;
}
}
interface JQuery {
tapTarget(method: keyof Pick<M.TapTarget, "open" | "close" | "destroy">): JQuery;
tapTarget(options?: Partial<M.TapTargetOptions>): JQuery;
}