1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 17:28:51 +02:00
phorge-phorge/webroot/rsrc/js/application/uiexample/notification-example.js
epriestley 1053a50f67 Add multiple notifications and notification types
Summary:
  - Allow more than one notification to be shown.
  - Allow notifications to be customized with extra classes.

Test Plan: {F12776}

Reviewers: allenjohnashton, ddfisher, keebuhm, jungejason

Reviewed By: jungejason

CC: aran

Maniphest Tasks: T944

Differential Revision: https://secure.phabricator.com/D2758
2012-06-17 11:35:36 -07:00

42 lines
1,015 B
JavaScript

/**
* @requires phabricator-notification
* javelin-stratcom
* javelin-behavior
* javelin-uri
* @provides javelin-behavior-phabricator-notification-example
*/
JX.behavior('phabricator-notification-example', function(config) {
JX.Stratcom.listen(
'click',
'notification-example',
function(e) {
e.kill();
var notification = new JX.Notification();
if (Math.random() > 0.1) {
notification.setContent('It is ' + new Date().toString());
notification.listen(
'activate',
function(e) {
if (!confirm("Close notification?")) {
e.kill();
}
});
} else {
notification
.setContent('Alert! Click to reload!')
.setDuration(0)
.setClassName('jx-notification-alert');
notification.listen(
'activate',
function(e) {
new JX.$U().go();
});
}
notification.show()
});
});