mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-10 09:40:21 +08:00
Add tingle.js (#27361)
This commit is contained in:
36
types/tingle.js/index.d.ts
vendored
Normal file
36
types/tingle.js/index.d.ts
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
// Type definitions for tingle.js 0.13
|
||||
// Project: https://github.com/robinparisi/tingle#readme
|
||||
// Definitions by: Klaus Meinhardt <https://github.com/ajafff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export interface Options {
|
||||
onOpen?: (this: modal) => void;
|
||||
onClose?: (this: modal) => void;
|
||||
beforeOpen?: () => void;
|
||||
beforeClose?: (this: modal) => boolean | undefined;
|
||||
stickyFooter?: boolean;
|
||||
footer?: boolean;
|
||||
cssClass?: string[];
|
||||
closeLabel?: string;
|
||||
closeMethods?: string[];
|
||||
}
|
||||
export class modal {
|
||||
constructor(options?: Options);
|
||||
setContent(content: string | Element): void;
|
||||
getContent(): HTMLDivElement;
|
||||
destroy(): void;
|
||||
open(): void;
|
||||
isOpen(): boolean;
|
||||
close(): void;
|
||||
setFooterContent(content: string): void;
|
||||
getFooterContent(): HTMLDivElement | undefined;
|
||||
setStickyFooter(sticky: boolean): void;
|
||||
addFooterBtn(
|
||||
label: string,
|
||||
cssClass: string | undefined,
|
||||
listener: HTMLElement['onclick'],
|
||||
): HTMLButtonElement;
|
||||
isOverflow(): boolean;
|
||||
checkOverflow(): void;
|
||||
}
|
||||
23
types/tingle.js/tingle.js-tests.ts
Normal file
23
types/tingle.js/tingle.js-tests.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { modal } from 'tingle.js';
|
||||
|
||||
let instance = new modal();
|
||||
instance.open();
|
||||
instance.checkOverflow();
|
||||
instance.close();
|
||||
instance.close();
|
||||
|
||||
instance = new modal({
|
||||
onOpen() {
|
||||
this.checkOverflow();
|
||||
},
|
||||
beforeClose() {
|
||||
return this.isOverflow();
|
||||
},
|
||||
});
|
||||
|
||||
instance.addFooterBtn('text', undefined, function(e) {
|
||||
e.x;
|
||||
this.innerText;
|
||||
});
|
||||
|
||||
instance.setStickyFooter(false);
|
||||
24
types/tingle.js/tsconfig.json
Normal file
24
types/tingle.js/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"tingle.js-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/tingle.js/tslint.json
Normal file
1
types/tingle.js/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user