mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 06:40:35 +08:00
jquery.notify: new typings for https://github.com/ehynds/jquery-notify
This commit is contained in:
31
types/jquery.notify/index.d.ts
vendored
Normal file
31
types/jquery.notify/index.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Type definitions for jQuery Notify UI Widget 1.5 by Eric Hynds
|
||||
// Project: https://github.com/ehynds/jquery-notify
|
||||
// Definitions by: Sergei Dorogin <https://github.com/evil-shrike>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
|
||||
interface JQueryNotifyOptions {
|
||||
close?: () => void;
|
||||
open?: () => void;
|
||||
custom?: boolean;
|
||||
disabled?: boolean;
|
||||
expires?: number;
|
||||
queue?: boolean;
|
||||
speed?: number;
|
||||
stack?: "below" | "above";
|
||||
}
|
||||
interface JQuery {
|
||||
notify (options?: JQueryNotifyOptions): JQueryNotifyWidget;
|
||||
notify (method: string, template: number, params?: Object, opts?: JQueryNotifyOptions): JQueryNotifyInstance;
|
||||
notify (method: string, params?: Object, opts?: JQueryNotifyOptions): JQueryNotifyInstance;
|
||||
}
|
||||
interface JQueryNotifyInstance extends JQuery {
|
||||
element: JQuery;
|
||||
isOpen: boolean;
|
||||
options: JQueryNotifyOptions;
|
||||
close (): void;
|
||||
open (): void;
|
||||
}
|
||||
interface JQueryNotifyWidget extends JQuery {
|
||||
}
|
||||
21
types/jquery.notify/jquery.notify-tests.ts
Normal file
21
types/jquery.notify/jquery.notify-tests.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
let $container: JQueryNotifyWidget = $("<div style='display:none' class='noprint'><div></div></div>").appendTo(document.body).notify();
|
||||
|
||||
let notification: JQueryNotifyInstance = $container.notify(
|
||||
"create",
|
||||
{}, // empty parameters
|
||||
{
|
||||
close: () => {
|
||||
console.log("closed");
|
||||
},
|
||||
open: () => {
|
||||
console.log("opened");
|
||||
},
|
||||
expires: 1000,
|
||||
speed: 100
|
||||
}
|
||||
);
|
||||
notification.element.html("<strong>text</strong>");
|
||||
|
||||
notification.element.click(() => {
|
||||
notification.close();
|
||||
});
|
||||
23
types/jquery.notify/tsconfig.json
Normal file
23
types/jquery.notify/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jquery.notify-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user