A collection of useful static methods to deal with JavaScript window object.
NOTE: Unless otherwise specified, all callback functions are under window
scope.
- Since:
- 1.0.0
Methods
(static) alert(message, titleopt, callbackopt)
Displays an alert dialog with the specified content and an OK
button.
Notes
The alert dialog should be used for messages which do not require any response on the part of the user, other than the acknowledgement of the message.
Dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overuse any function that creates a dialog box (or modal window).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
String | Text you want to display in the alert dialog, or, alternatively, an object that is converted into a string and displayed. |
|
title |
String |
<optional> |
Title you want to display in the alert dialog. |
callback |
function |
<optional> |
Callback function to be invoked after the message box is closed. |
- Since:
- 1.0.0
- See:
Throws:
-
If invalid argument
- Type
- TypeError
(static) confirm(message, titleopt, okCallbackopt, cancelCallbackopt)
Displays a modal dialog with a message and two buttons, OK
and Cancel
.
Notes
Dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overuse any function that creates a dialog box (or modal window).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
String | Text you want to display in the dialog, or, alternatively, an object that is converted into a string and displayed. |
|
title |
String |
<optional> |
Title you want to display in the dialog. |
okCallback |
function |
<optional> |
Callback function to be invoked after user clicks on the |
cancelCallback |
function |
<optional> |
Callback function to be invoked after user clicks on the |
- Since:
- 1.0.0
- See:
Throws:
-
If invalid argument
- Type
- TypeError
(static) open(externalURL)
Loads a resource into a new browsing context (such as a window), depending on the browser preferences.
This method creates a new secondary browser window, similar to choosing New Window from the File menu. The new window is created with the default toolbars of the main window.
Note that remote URLs won't load immediately. The actual fetching of the URL is deferred and starts after the current script block finishes executing. The window creation and the loading of the referenced resource are done asynchronously.
Parameters:
Name | Type | Description |
---|---|---|
externalURL |
String | The URL to be loaded in the newly opened window. It can be an HTML document on the web, image file or any resource supported by the browser. |
- Since:
- 1.0.0
- See:
Throws:
-
If invalid argument
- Type
- TypeError