mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-18 04:24:30 +08:00
Updated bootstrap-notify to v3.1.3
This commit is contained in:
51
bootstrap-notify/bootstrap-notify-test.ts
Normal file
51
bootstrap-notify/bootstrap-notify-test.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/// <reference path="bootstrap-notify.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
//Test for bootstrap-notify v3.1.3
|
||||
|
||||
$.notify({
|
||||
// options
|
||||
icon: 'glyphicon glyphicon-warning-sign',
|
||||
title: 'Bootstrap notify',
|
||||
message: 'Turning standard Bootstrap alerts into "notify" like notifications',
|
||||
url: 'https://github.com/mouse0270/bootstrap-notify',
|
||||
target: '_blank'
|
||||
},{
|
||||
// settings
|
||||
element: 'body',
|
||||
position: null,
|
||||
type: "info",
|
||||
allow_dismiss: true,
|
||||
newest_on_top: false,
|
||||
showProgressbar: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "right"
|
||||
},
|
||||
offset: 20,
|
||||
spacing: 10,
|
||||
z_index: 1031,
|
||||
delay: 5000,
|
||||
timer: 1000,
|
||||
url_target: '_blank',
|
||||
mouse_over: null,
|
||||
animate: {
|
||||
enter: 'animated fadeInDown',
|
||||
exit: 'animated fadeOutUp'
|
||||
},
|
||||
onShow: null,
|
||||
onShown: null,
|
||||
onClose: null,
|
||||
onClosed: null,
|
||||
icon_type: 'class',
|
||||
template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-{0}" role="alert">' +
|
||||
'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
|
||||
'<span data-notify="icon"></span> ' +
|
||||
'<span data-notify="title">{1}</span> ' +
|
||||
'<span data-notify="message">{2}</span>' +
|
||||
'<div class="progress" data-notify="progressbar">' +
|
||||
'<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
|
||||
'</div>' +
|
||||
'<a href="{3}" target="{4}" data-notify="url"></a>' +
|
||||
'</div>'
|
||||
});
|
||||
109
bootstrap-notify/bootstrap-notify.d.ts
vendored
109
bootstrap-notify/bootstrap-notify.d.ts
vendored
@@ -1,68 +1,59 @@
|
||||
// Type definitions for bootstrap-notify
|
||||
// Project: https://github.com/Nijikokun/bootstrap-notify
|
||||
// Definitions by: Blake Niemyjski <https://github.com/niemyjski/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Type definitions for bootstrap-notify v3.1.3
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
interface NotifyOptions {
|
||||
/**
|
||||
Alert style, omit alert- from style name.
|
||||
@param {string} type
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
Allow alert to be closable through a close icon.
|
||||
@param {boolean} closable
|
||||
*/
|
||||
closable?: boolean;
|
||||
/**
|
||||
Alert transition, pretty sure only fade is supported, you can try others if you wish.
|
||||
@param {string} transition
|
||||
*/
|
||||
transition?: string;
|
||||
/**
|
||||
Fade alert out after a certain delay (in ms)
|
||||
@param {string} fadeOut
|
||||
*/
|
||||
fadeOut?: NotifyFadeOutSettings;
|
||||
/**
|
||||
Text to show on alert, you can use either html or text. HTML will override text.
|
||||
@param {MessageOptions} message
|
||||
*/
|
||||
message?: MessageOptions;
|
||||
/**
|
||||
Called before alert closes.
|
||||
@param {function} onClose
|
||||
*/
|
||||
onClose?: () => void;
|
||||
/**
|
||||
Called after alert closes.
|
||||
@param {function} onClosed
|
||||
*/
|
||||
onClosed?: () => void;
|
||||
/* tslint:disable: interface-name no-any */
|
||||
|
||||
interface JQueryStatic {
|
||||
/* tslint:enable: interface-name */
|
||||
notify(message: string): INotifyReturn;
|
||||
notify(opts: INotifyOptions, settings?: INotifySettings): INotifyReturn;
|
||||
notifyDefaults(settings: INotifySettings): void;
|
||||
notifyClose(): void;
|
||||
notifyClose(command: string): void;
|
||||
}
|
||||
|
||||
interface NotifyFadeOutSettings {
|
||||
enabled?: boolean;
|
||||
delay?: number;
|
||||
interface INotifyOptions {
|
||||
message: string;
|
||||
title?: string;
|
||||
icon?: string;
|
||||
url?: string;
|
||||
target?: string;
|
||||
}
|
||||
|
||||
interface MessageOptions {
|
||||
html?: string;
|
||||
text?: string;
|
||||
interface INotifySettings {
|
||||
element?: string;
|
||||
position?: string;
|
||||
type?: string;
|
||||
allow_dismiss?: boolean;
|
||||
allow_duplicates?: boolean;
|
||||
newest_on_top?: boolean;
|
||||
showProgressbar?: boolean;
|
||||
placement?: {
|
||||
from?: string;
|
||||
align?: string;
|
||||
};
|
||||
offset?: number;
|
||||
spacing?: number;
|
||||
z_index?: number;
|
||||
delay?: number;
|
||||
timer?: number;
|
||||
url_target?: string;
|
||||
mouse_over?: string;
|
||||
animate?: {
|
||||
enter?: string;
|
||||
exit?: string;
|
||||
};
|
||||
onShow?: () => void;
|
||||
onShown?: () => void;
|
||||
onClose?: () => void;
|
||||
onClosed?: () => void;
|
||||
icon_type?: string;
|
||||
template?: string;
|
||||
}
|
||||
|
||||
interface Notification {
|
||||
show();
|
||||
hide();
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
Creates a notification instance with default options.
|
||||
@constructor
|
||||
@param {NotifyOptions} options
|
||||
*/
|
||||
notify(options: NotifyOptions): Notification;
|
||||
interface INotifyReturn {
|
||||
$ele: JQueryStatic;
|
||||
close: () => void;
|
||||
update: (command: string, update: any) => void;
|
||||
}
|
||||
Reference in New Issue
Block a user