1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-11 01:12:41 +01:00
phorge-phorge/webroot/rsrc/js/application/uiexample/notification-example.js

43 lines
1,015 B
JavaScript
Raw Normal View History

/**
* @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()
});
});