forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// <reference path="alertify.d.ts" /> | ||
|
||
alertify.init(); | ||
|
||
alertify.alert("This is an alert"); | ||
alertify.alert("This is an alert with a callback", () => { | ||
alertify.success("Alert finished"); | ||
}, "myCustomClass"); | ||
|
||
|
||
alertify.confirm("This is a confirm request"); | ||
alertify.confirm("This is a confirm request with a callback", () => { | ||
alertify.success("Confirm finished"); | ||
}, "myCustomClass"); | ||
|
||
var custom = alertify.extend("custom"); | ||
|
||
alertify.log("log message 1"); | ||
alertify.log("log message 2", "success", 3000); | ||
|
||
alertify.prompt("prompt message 1"); | ||
alertify.prompt("prompt message 2", () => { console.log("callback"); }, "ok", "myClass"); | ||
|
||
alertify.set({ delay: 1000 }); | ||
alertify.set({ labels: { ok: "OK", cancel: "Cancel" }}); | ||
alertify.set({ buttonFocus: "ok" }); | ||
alertify.set({ buttonReverse: true }); | ||
|
||
alertify.success("This is a success message"); | ||
alertify.error("This is an error message"); | ||
|
||
alertify.debug(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
// Type definitions for alertify 0.3.11 | ||
// Project: http://fabien-d.github.io/alertify.js/ | ||
// Definitions by: John Jeffery <http://github.com/jjeffery> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
declare var alertify: alertify.IAlertifyStatic; | ||
|
||
declare module alertify { | ||
interface IAlertifyStatic { | ||
/** | ||
* Create an alert dialog box | ||
* @param message The message passed from the callee | ||
* @param fn Callback function | ||
* @param cssClass Class(es) to append to dialog box | ||
* @return alertify (ie this) | ||
* @since 0.0.1 | ||
*/ | ||
alert(message: string, fn?: Function, cssClass?: string): IAlertifyStatic; | ||
|
||
/** | ||
* Create a confirm dialog box | ||
* @param message The message passed from the callee | ||
* @param fn Callback function | ||
* @param cssClass Class(es) to append to dialog box | ||
* @return alertify (ie this) | ||
* @since 0.0.1 | ||
*/ | ||
confirm(message: string, fn?: Function, cssClass?: string): IAlertifyStatic; | ||
|
||
/** | ||
* Extend the log method to create custom methods | ||
* @param type Custom method name | ||
* @return function for logging | ||
* @since 0.0.1 | ||
*/ | ||
extend(type: string): (message: string, wait?: number) => IAlertifyStatic; | ||
|
||
/** | ||
* Initialize Alertify and create the 2 main elements. | ||
* Initialization will happen automatically on the first | ||
* use of alert, confirm, prompt or log. | ||
* @since 0.0.1 | ||
*/ | ||
init(): void; | ||
|
||
/** | ||
* Show a new log message box | ||
* @param message The message passed from the callee | ||
* @param type Optional type of log message | ||
* @param wait Optional time (in ms) to wait before auto-hiding | ||
* @return alertify (ie this) | ||
* @since 0.0.1 | ||
*/ | ||
log(message: string, type?: string, wait?: number): IAlertifyStatic; | ||
|
||
/** | ||
* Create a prompt dialog box | ||
* @param message The message passed from the callee | ||
* @param fn Callback function | ||
* @param placeholder Default value for prompt input | ||
* @param cssClass Class(es) to append to dialog | ||
* @return alertify (ie this) | ||
* @since 0.0.1 | ||
*/ | ||
prompt(message: string, fn?: Function, placeholder?: string, cssClass?: string): IAlertifyStatic; | ||
|
||
/** | ||
* Shorthand for log messages | ||
* @param message The message passed from the callee | ||
* @return alertify (ie this) | ||
* @since 0.0.1 | ||
*/ | ||
success(message: string): IAlertifyStatic; | ||
|
||
/** | ||
* Shorthand for log messages | ||
* @param message The message passed from the callee | ||
* @return alertify (ie this) | ||
* @since 0.0.1 | ||
*/ | ||
error(message: string): IAlertifyStatic; | ||
|
||
/** | ||
* Used to set alertify properties | ||
* @param Properties | ||
* @since 0.2.11 | ||
*/ | ||
set(args: IProperties): void; | ||
|
||
/** | ||
* The labels used for dialog buttons | ||
*/ | ||
labels: ILabels; | ||
|
||
/** | ||
* Attaches alertify.error to window.onerror method | ||
* @since 0.3.8 | ||
*/ | ||
debug(): void; | ||
} | ||
|
||
/** | ||
* Properties for alertify.set function | ||
*/ | ||
interface IProperties { | ||
/** Default value for milliseconds display of log messages */ | ||
delay?: number; | ||
|
||
/** Default values for display of labels */ | ||
labels?: ILabels; | ||
|
||
/** Default button for focus */ | ||
buttonFocus?: string; | ||
|
||
/** Should buttons be displayed in reverse order */ | ||
buttonReverse?: boolean; | ||
} | ||
|
||
/** Labels for altertify.set function */ | ||
interface ILabels { | ||
ok?: string; | ||
cancel?: string; | ||
} | ||
} |