From: Fomafix Date: Wed, 13 Aug 2014 21:31:48 +0000 (+0000) Subject: mediawiki.notify: Simplify callback by using .then() X-Git-Tag: 1.31.0-rc.0~14436^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=cf5e112ef946ae915d17dd3ee184c15b36dc3bf2;p=lhc%2Fweb%2Fwiklou.git mediawiki.notify: Simplify callback by using .then() Change-Id: Ifff25534d716721ff1d2d4484dbd0f63161ecb43 --- diff --git a/resources/src/mediawiki/mediawiki.notify.js b/resources/src/mediawiki/mediawiki.notify.js index 743d651728..c1e1dabfc7 100644 --- a/resources/src/mediawiki/mediawiki.notify.js +++ b/resources/src/mediawiki/mediawiki.notify.js @@ -1,7 +1,7 @@ /** * @class mw.plugin.notify */ -( function ( mw, $ ) { +( function ( mw ) { 'use strict'; /** @@ -11,13 +11,12 @@ * @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 () { - // Call notify with the notification the user requested of us. - d.resolve( mw.notification.notify( message, options ) ); - }, d.reject ); - return d.promise(); + return mw.loader.using( 'mediawiki.notification' ) + .then( function () { + // Call notify with the notification the user requested of us. + return mw.notification.notify( message, options ); + } ); }; /** @@ -25,4 +24,4 @@ * @mixins mw.plugin.notify */ -}( mediaWiki, jQuery ) ); +}( mediaWiki ) );