UI widgets: support event-based notifications

Triggering 'cloudStack.addNotification' adds a new UI notification, to
avoid having to specify DOM element containing the jQuery widget every
time. This event accepts same args as .notifications('add', ...)

Example:

$(window).trigger('cloudStack.addNotification', {
  desc: 'Description',
  interval: 1000,
  poll: function(args) {
    ...
    args.complete();
  }
});
This commit is contained in:
bfederle 2011-12-22 08:41:40 -08:00
parent 93fcd024a5
commit c60501e950
1 changed files with 5 additions and 1 deletions

View File

@ -230,7 +230,11 @@
return this;
};
// Events
// Setup notification listener -- accepts same args as
$(window).bind('cloudStack.addNotification', function(event, data) {
$('.notifications').notifications('add', data);
});
$(document).click(function(event) {
var $target = $(event.target);
var $attachTo, $popup;