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