mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 23:24:39 +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,19 +1,16 @@
|
|||
var types = require( './types.json' );
|
||||
// Load Popups outside the critical rendering path (T176211) provided that touch events
|
||||
// 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;
|
||||
if ( !isTouchDevice ) {
|
||||
mw.loader.using( types.concat( [ 'ext.popups.main' ] ) ).then( function () {
|
||||
// Load custom popup types
|
||||
types.forEach( function ( moduleName ) {
|
||||
var module = require( moduleName );
|
||||
mw.popups.register( module );
|
||||
} );
|
||||
// For now this API is limited to extensions/skins as we have not had a chance to
|
||||
// consider the implications of gadgets having access to this function and dealing with
|
||||
// challenges such as selector overlap.
|
||||
delete mw.popups.register;
|
||||
// Load Popups when touch events are not available in the browser (e.g. not a mobile device).
|
||||
var isTouchDevice = 'ontouchstart' in document.documentElement;
|
||||
if ( !isTouchDevice ) {
|
||||
mw.loader.using( types.concat( [ 'ext.popups.main' ] ) ).then( function () {
|
||||
// Load custom popup types
|
||||
types.forEach( function ( moduleName ) {
|
||||
var module = require( moduleName );
|
||||
mw.popups.register( module );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
// For now this API is limited to extensions/skins as we have not had a chance to
|
||||
// consider the implications of gadgets having access to this function and dealing with
|
||||
// challenges such as selector overlap.
|
||||
delete mw.popups.register;
|
||||
} );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue