mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-24 07:34:11 +00:00
Performance: Remove unnecessary requestIdleCallback delay
Load page previews as quickly as possible. According to performance team it should be beneficial to remove this (See Ibc01f6a82692c7dd3d4a866354ab975af114e7b0 for more information) and it's not a recommendation. its existence in this codebase is leading to misunderstandings elsewhere. Change-Id: If183d9ca07d98c03c957f359c13ca8e2ede7ad58
This commit is contained in:
parent
79aae50c7a
commit
2517c6d32f
|
@ -1,7 +1,5 @@
|
||||||
var types = require( './types.json' );
|
var types = require( './types.json' );
|
||||||
// Load Popups outside the critical rendering path (T176211) provided that touch events
|
// Load Popups when touch events are not available in the browser (e.g. not a mobile device).
|
||||||
// are not available in the browser. If touch events are enabled page previews will not load.
|
|
||||||
mw.requestIdleCallback( function () {
|
|
||||||
var isTouchDevice = 'ontouchstart' in document.documentElement;
|
var isTouchDevice = 'ontouchstart' in document.documentElement;
|
||||||
if ( !isTouchDevice ) {
|
if ( !isTouchDevice ) {
|
||||||
mw.loader.using( types.concat( [ 'ext.popups.main' ] ) ).then( function () {
|
mw.loader.using( types.concat( [ 'ext.popups.main' ] ) ).then( function () {
|
||||||
|
@ -16,4 +14,3 @@ mw.requestIdleCallback( function () {
|
||||||
delete mw.popups.register;
|
delete mw.popups.register;
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
} );
|
|
||||||
|
|
Loading…
Reference in a new issue