Last modified: 2011-09-27 16:40:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T30995, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28995 - Public interface for getting loader state of a ResourcerLoader module
Public interface for getting loader state of a ResourcerLoader module
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.17.x
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Trevor Parscal
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-15 11:59 UTC by Bergi
Modified: 2011-09-27 16:40 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
proposed patch (5.16 KB, patch)
2011-05-15 11:59 UTC, Bergi
Details

Description Bergi 2011-05-15 11:59:48 UTC
Created attachment 8538 [details]
proposed patch

Sometimes userscripts need to know about the registrated modules, mostly about their state. A further enhancement could be something like
mw.loader.getModules = function() {
   return Object.keys(registry);
}
but I don't think is really needed.

My patch also resolves inconsistencies in the naming conventions of getters and setters; I think there should be a clear difference.
Comment 1 Mark A. Hershberger 2011-05-15 14:29:30 UTC
r88185 & r88184
Comment 2 Krinkle 2011-05-30 21:08:06 UTC
Just curious, but what exactly is the usecase behind this ?

Currently in trunk resourceloader is becoming more asynchronous, so states maybe changing rapidly and in unexpected orders.

I couldnt' think of any obvious usecase where a module would want or need to know the load status of another one. Please enlighten me so we can write tests for this to make sure whatever you do with this will keep working in ResourceLoader 2.0.

--
Krinkle
Comment 3 Bergi 2011-09-22 19:46:08 UTC
It's not so much about getting the loading state, it's about knowing whether a module is loaded/does load or not. For example there might be user scripts that enhance modules. They can't use loader.using, because that would load the module even when it's not needed.
Of course there may be other methods to determine whether a module is loaded on the current page (like simple [list, of, page, names].indexOf(wgPageName)>-1), but it would be better if the resource loader had an api for that.
Comment 4 Krinkle 2011-09-27 00:27:26 UTC
Do you want to determine whether a module is registered or loaded ?
Comment 5 Bergi 2011-09-27 16:40:06 UTC
No, it's not interesting whether a module is available or not (that doesn't change for each page), I want to know whether it is (or will be) used.
Maybe it would be a better idea to make the load-event public than to allow checking the load state.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links