Preload module 'mediawiki.notification'
authorFomafix <fomafix@googlemail.com>
Fri, 2 Feb 2018 18:27:55 +0000 (19:27 +0100)
committerFomafix <fomafix@googlemail.com>
Fri, 2 Feb 2018 18:27:55 +0000 (19:27 +0100)
Preload the module 'mediawiki.notification' in parallel to the API
request because mw.notify is called on API response.

Change-Id: Ief8de75bc9392315a867fe1c4cf11ce4d0e9bfb8

resources/src/mediawiki.special/mediawiki.special.unwatchedPages.js
resources/src/mediawiki.special/mediawiki.special.watchlist.js

index 7628ff8..34c8bbd 100644 (file)
@@ -19,6 +19,9 @@
                        }
                        $link.data( 'mwDisabled', true ).addClass( 'mw-watch-link-disabled' );
 
+                       // Preload the notification module for mw.notify
+                       mw.loader.load( 'mediawiki.notification' );
+
                        // Use the class to determine whether to watch or unwatch
                        if ( !$subjectLink.hasClass( 'mw-watched-item' ) ) {
                                $link.text( mw.msg( 'watching' ) );
index 4319be7..565ed2c 100644 (file)
@@ -97,6 +97,9 @@
                                        } );
                                }
 
+                               // Preload the notification module for mw.notify
+                               mw.loader.load( 'mediawiki.notification' );
+
                                // Depending on whether we are watching or unwatching, for each entry of the page (and its associated page i.e. Talk),
                                // change the text, tooltip, and non-JS href of the (un)watch button, and update the styling of the watchlist entry.
                                if ( $unwatchLink.hasClass( 'mw-unwatch-link' ) ) {