diff options
Diffstat (limited to 'resources/mediawiki/mediawiki.notify.js')
-rw-r--r-- | resources/mediawiki/mediawiki.notify.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/resources/mediawiki/mediawiki.notify.js b/resources/mediawiki/mediawiki.notify.js index 83d95b61..743d6517 100644 --- a/resources/mediawiki/mediawiki.notify.js +++ b/resources/mediawiki/mediawiki.notify.js @@ -1,22 +1,23 @@ /** * @class mw.plugin.notify */ -( function ( mw ) { +( function ( mw, $ ) { 'use strict'; /** * @see mw.notification#notify * @param message * @param options + * @return {jQuery.Promise} */ mw.notify = function ( message, options ) { + var d = $.Deferred(); // 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. - mw.notify( message, options ); - } ); + d.resolve( mw.notification.notify( message, options ) ); + }, d.reject ); + return d.promise(); }; /** @@ -24,4 +25,4 @@ * @mixins mw.plugin.notify */ -}( mediaWiki ) ); +}( mediaWiki, jQuery ) ); |