Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/113540

Change subject: Preload mediawiki.notification when we know we're going to need 
it soon
......................................................................

Preload mediawiki.notification when we know we're going to need it soon

The mediawiki.notification 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
---
M resources/mediawiki.page/mediawiki.page.patrol.ajax.js
M resources/mediawiki.page/mediawiki.page.watch.ajax.js
2 files changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/40/113540/1

diff --git a/resources/mediawiki.page/mediawiki.page.patrol.ajax.js 
b/resources/mediawiki.page/mediawiki.page.patrol.ajax.js
index 75908ee..a9a7f6d 100644
--- a/resources/mediawiki.page/mediawiki.page.patrol.ajax.js
+++ b/resources/mediawiki.page/mediawiki.page.patrol.ajax.js
@@ -16,6 +16,9 @@
                $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' );
+
                        // Hide the link and create a spinner to show it inside 
the brackets.
                        $spinner = $.createSpinner( {
                                size: 'small',
diff --git a/resources/mediawiki.page/mediawiki.page.watch.ajax.js 
b/resources/mediawiki.page/mediawiki.page.watch.ajax.js
index 998a8c2..f638604 100644
--- a/resources/mediawiki.page/mediawiki.page.watch.ajax.js
+++ b/resources/mediawiki.page/mediawiki.page.watch.ajax.js
@@ -111,6 +111,9 @@
                $links.click( function ( e ) {
                        var action, api, $link;
 
+                       // Start preloading the notification module (normally 
loaded by mw.notify())
+                       mw.loader.load( 'mediawiki.notification' );
+
                        action = mwUriGetAction( this.href );
 
                        if ( action !== 'watch' && action !== 'unwatch' ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d20af3a2f261cd93d5d5fd2b81cccae79697481
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to