The mediawiki.notification module is normally lazy-loaded when
mw.notify() is called; however, this results in often-noticeable delay
between when the action we're notifying about is complete and when the
actual notification appears.
Let's explicitly mw.loader.load() the module in event handlers which
are going to later asynchronously fire a notification. I could only
find two such situations in core: in mediawiki.page.patrol.ajax and
mediawiki.page.watch.ajax.
Bug: 53990
Change-Id: I9d20af3a2f261cd93d5d5fd2b81cccae79697481
$patrolLinks.on( 'click', function ( e ) {
var $spinner, href, rcid, apiRequest;
+ // Start preloading the notification module (normally loaded by mw.notify())
+ mw.loader.load( ['mediawiki.notification'], null, true );
+
// Hide the link and create a spinner to show it inside the brackets.
$spinner = $.createSpinner( {
size: 'small',
$links.click( function ( e ) {
var action, api, $link;
+ // Start preloading the notification module (normally loaded by mw.notify())
+ mw.loader.load( ['mediawiki.notification'], null, true );
+
action = mwUriGetAction( this.href );
if ( action !== 'watch' && action !== 'unwatch' ) {