Fomafix has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354148 )

Change subject: Deprecate public global class mw.notification
......................................................................

Deprecate public global class mw.notification

Load the class via
  require( 'mediawiki.notification' )
or use mw.notify with lazy loading instead.

Change-Id: I560d1b7a1f499cd264fb2feff730e04d20036b5f
---
M resources/src/mediawiki/mediawiki.notification.convertmessagebox.js
M resources/src/mediawiki/mediawiki.notification.js
M resources/src/mediawiki/mediawiki.notify.js
3 files changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/48/354148/1

diff --git 
a/resources/src/mediawiki/mediawiki.notification.convertmessagebox.js 
b/resources/src/mediawiki/mediawiki.notification.convertmessagebox.js
index 5d46de6..4f8241f 100644
--- a/resources/src/mediawiki/mediawiki.notification.convertmessagebox.js
+++ b/resources/src/mediawiki/mediawiki.notification.convertmessagebox.js
@@ -23,6 +23,7 @@
         */
        function convertmessagebox( options ) {
                var $msgBox, type, autoHide, msg, notif,
+                       notification = require( 'mediawiki.notification' ),
                        $successBox = $( '.mw-notify-success' ),
                        $warningBox = $( '.mw-notify-warning' ),
                        $errorBox = $( '.mw-notify-error' );
@@ -47,7 +48,7 @@
                msg = options && options.msg || $msgBox.text();
                $msgBox.detach();
 
-               notif = mw.notification.notify( msg, { autoHide: autoHide, 
type: type } );
+               notif = notification.notify( msg, { autoHide: autoHide, type: 
type } );
                if ( !autoHide ) {
                        // 'change' event not reliable!
                        $( document ).one( 'keydown mousedown', function () {
diff --git a/resources/src/mediawiki/mediawiki.notification.js 
b/resources/src/mediawiki/mediawiki.notification.js
index d36c4a0..a283b18 100644
--- a/resources/src/mediawiki/mediawiki.notification.js
+++ b/resources/src/mediawiki/mediawiki.notification.js
@@ -436,6 +436,9 @@
                }
        } );
 
-       mw.notification = notification;
+       module.exports = notification;
+       mw.log.deprecate( mw, 'notification', notification,
+               'Use "require( \'mediawiki.notification\' )" or "mw.notify" 
instead.'
+       );
 
 }( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki/mediawiki.notify.js 
b/resources/src/mediawiki/mediawiki.notify.js
index 0f3a086..164e3a5 100644
--- a/resources/src/mediawiki/mediawiki.notify.js
+++ b/resources/src/mediawiki/mediawiki.notify.js
@@ -14,9 +14,10 @@
        mw.notify = function ( message, options ) {
                // Don't bother loading the whole notification system if we 
never use it.
                return mw.loader.using( 'mediawiki.notification' )
-                       .then( function () {
+                       .then( function ( require ) {
+                               var notification = require( 
'mediawiki.notification' );
                                // Call notify with the notification the user 
requested of us.
-                               return mw.notification.notify( message, options 
);
+                               return notification.notify( message, options );
                        } );
        };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/354148
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I560d1b7a1f499cd264fb2feff730e04d20036b5f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Fomafix <foma...@googlemail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to