https://bugzilla.wikimedia.org/show_bug.cgi?id=38782
Web browser: ---
Bug #: 38782
Summary: Allow mw.loader.using adding dependency without
loading the module
Product: MediaWiki
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: ResourceLoader
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected],
[email protected]
Classification: Unclassified
Mobile Platform: ---
When manipulate the toolbar with user or site javascript you have to wait until
'mediawiki.action.edit' is "ready", but the code
mw.loader.using( [ 'mediawiki.action.edit' ], function() {
...
});
will load 'mediawiki.action.edit' on each page. Adding a check for wgAction !==
edit and submit is a solution, but for other modules you have to know, where it
is running and adding that check, that is bad, when the condition is changed.
Having a method inside the loader, which allow executing a function after all
dependency are ready without requesting the modules, can help here. When the
page is ready and the dependency is not loaded, than the loader ignore this
function.
For example:
mw.loader.usingIfExist( [ 'mediawiki.action.edit' ], function() {
...
});
will only executing the function when 'mediawiki.action.edit' is loaded on the
page and will not requesting the module itself. When the module is not loaded,
the function is ignored.
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l