Bug: 51338
Change-Id: Icd7fd1ac328094ddc2560d4804dd52fc85879867
* @param {HTMLElement|jQuery|mw.Message|string} message
* @param {Object} options The options to use for the notification.
* See #defaults for details.
* @param {HTMLElement|jQuery|mw.Message|string} message
* @param {Object} options The options to use for the notification.
* See #defaults for details.
+ * @return {Object} Object with a close function to close the notification
*/
notify: function ( message, options ) {
var notif;
*/
notify: function ( message, options ) {
var notif;
} else {
preReadyNotifQueue.push( notif );
}
} else {
preReadyNotifQueue.push( notif );
}
+ return { close: $.proxy( notif.close, notif ) };
/**
* @class mw.plugin.notify
*/
/**
* @class mw.plugin.notify
*/
'use strict';
/**
* @see mw.notification#notify
* @param message
* @param options
'use strict';
/**
* @see mw.notification#notify
* @param message
* @param options
+ * @return {jQuery.Promise}
*/
mw.notify = function ( message, options ) {
*/
mw.notify = function ( message, options ) {
// Don't bother loading the whole notification system if we never use it.
mw.loader.using( 'mediawiki.notification', function () {
// Don't bother loading the whole notification system if we never use it.
mw.loader.using( 'mediawiki.notification', function () {
- // Don't bother calling mw.loader.using a second time after we've already loaded mw.notification.
- mw.notify = mw.notification.notify;
// Call notify with the notification the user requested of us.
// Call notify with the notification the user requested of us.
- mw.notify( message, options );
- } );
+ d.resolve( mw.notification.notify( message, options ) );
+ }, d.reject );
+ return d.promise();
* @mixins mw.plugin.notify
*/
* @mixins mw.plugin.notify
*/
+}( mediaWiki, jQuery ) );