From c1171b9da80c2623d2ba563b1dc3d20f75d98a8a Mon Sep 17 00:00:00 2001 From: John Papa Date: Mon, 24 Dec 2012 12:19:11 -0500 Subject: [PATCH 1/2] updated for v1.2 --- toastr/toastr-1.2.d.ts | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 toastr/toastr-1.2.d.ts diff --git a/toastr/toastr-1.2.d.ts b/toastr/toastr-1.2.d.ts new file mode 100644 index 000000000..337c0c19e --- /dev/null +++ b/toastr/toastr-1.2.d.ts @@ -0,0 +1,47 @@ +/// +// Type definitions for Toastr 1.0 +// Project: https://github.com/CodeSeven/toastr +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface ToastrOptions { + tapToDismiss?: bool; + toastClass?: string; + containerId?: string; + debug?: bool; + fadeIn?: number; + fadeOut?: number; + extendedTimeOut?: number; + iconClasses?: { + error: string; + info: string; + success: string; + warning: string; + }; + iconClass?: string; + positionClass?: string; + timeOut?: number; + titleClass?: string; + messageClass?: string; + + onclick?: () => void; +} + +interface ToastrDisplayMethod { + (message: string): JQuery; + (message: string, title: string): JQuery; + (message: string, title: string, overrides: ToastrOptions): JQuery; +} + +interface Toastr { + clear(): void; + clear(toast: JQuery): void; + error: ToastrDisplayMethod; + info: ToastrDisplayMethod; + options: ToastrOptions; + success: ToastrDisplayMethod; + warning: ToastrDisplayMethod; + version: string; +} + +declare var toastr: Toastr; \ No newline at end of file From e856597aac995c95c0178045f75d5bd1b4101eea Mon Sep 17 00:00:00 2001 From: John Papa Date: Mon, 24 Dec 2012 12:23:00 -0500 Subject: [PATCH 2/2] updated tests --- toastr/toastr-1.0.d.ts | 48 ------------------------------------------ toastr/toastr-tests.ts | 24 +++++++++++++-------- 2 files changed, 15 insertions(+), 57 deletions(-) delete mode 100644 toastr/toastr-1.0.d.ts diff --git a/toastr/toastr-1.0.d.ts b/toastr/toastr-1.0.d.ts deleted file mode 100644 index e4c842ec9..000000000 --- a/toastr/toastr-1.0.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Type definitions for Toastr 1.0 -// Project: https://github.com/CodeSeven/toastr -// Definitions by: Boris Yankov -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -/// - -interface ToastrOptions { - tapToDismiss?: bool; - toastClass?: string; - containerId?: string; - debug?: bool; - fadeIn?: number; - fadeOut?: number; - extendedTimeOut?: number; - iconClasses?: { - error: string; - info: string; - success: string; - warning: string; - }; - iconClass?: string; - positionClass?: string; - timeOut?: number; - titleClass?: string; - messageClass?: string; - - onclick?: () => void; -} - -interface ToastrDisplayMethod { - (message: string): JQuery; - (message: string, title: string): JQuery; - (message: string, title: string, overrides: ToastrOptions): JQuery; -} - -interface Toastr { - options: ToastrOptions; - - clear(): void; - info: ToastrDisplayMethod; - warning: ToastrDisplayMethod; - success: ToastrDisplayMethod; - error: ToastrDisplayMethod; -} - -declare var toastr: Toastr; diff --git a/toastr/toastr-tests.ts b/toastr/toastr-tests.ts index 7e7e8352b..cc99b28ce 100644 --- a/toastr/toastr-tests.ts +++ b/toastr/toastr-tests.ts @@ -1,17 +1,18 @@ -/// +/// function test_basic() { - toastr.info('Are you the 6 fingered man?'); - toastr.warning('My name is Inigo Montoya. You Killed my father, prepare to die!'); - toastr.success('Have fun storming the castle!', 'Miracle Max Says'); - toastr.error('I do not think that word means what you tink it means.', 'Inconceivable!'); - toastr.clear(); + var t = []; + t.push(toastr.info('Are you the 6 fingered man?')); + t.push(toastr.warning('My name is Inigo Montoya. You Killed my father, prepare to die!')); + t.push(toastr.success('Have fun storming the castle!', 'Miracle Max Says')); + t.push(toastr.error('I do not think that word means what you think it means.', 'Inconceivable!')); + toastr.clear(t[0]); // clear 1 + toastr.clear(); // clear all var msg = 'Do you think Rodents of Unusual Size really exist?'; var title = 'Fireswamp Legends'; var overrides = { timeOut: 250 }; toastr.warning(msg, title, overrides); - toastr.options.onclick = function () { } } @@ -55,6 +56,11 @@ function test_fromdemo() { alert('Surprise! you clicked me. i was toast #' + toastIndex + '. You could perform an action here.') }) } - - }); + }); + $('#clearlasttoast').click(function() { + toastr.clear($toastlast); + }); + $('#cleartoasts').click(function () { + toastr.clear(); + }); } \ No newline at end of file