JS Alerts

From FreeDESK
Revision as of 23:22, 27 June 2012 by Dave (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



The on-screen alerts are the little coloured information bars you get at the top of the screen and are created using the Alerts instance of FreeDESK_Alerts

Use and Example

To add an alert call the method Alerts.add(text, level, autoRemove) with the options being the text to display, the level (0 is good and green in default CSS, 1 is warning and yellow in default CSS and 2 is bad and red in default CSS), the autoRemove is the number of seconds to display the alert for (0 means display forever until user manually clicks to close.


Alerts.add("Hello World",0,20); // a green ok alert for 20 seconds
Alerts.add("Error!",2,0); // An error (red) that must manually be removed

Other Functions

Alerts.clear() will clear all alerts.

Alerts.randomTest() will display a random-level and random-text alert for the default timeout.

Personal tools