Topic on Talk:ResourceLoader/Package files

Jump to navigation Jump to search
Jdlrobson (talkcontribs)

What is the advantage of using main=>true rather than just making it the first file. What sort of problems does that solve?

I'm curious as this complicates the rules/definitions and I'm not sure why it's necessary.

Similarly, I've not worked out why callback is useful, so would be useful to have some illustrative examples showing use cases I haven't thought of yet.

Roan Kattouw (WMF) (talkcontribs)

I'll add some more real-life examples to the list Kosta started. I do have a real-life example or two where the callback feature came in handy, for exporting things that are known server-side. For example, the list of all language names in the current language is a config-like thing that's not technically a config, but is instead the return value of Language::fetchLanguageNames().

Roan Kattouw (WMF) (talkcontribs)

As for main=>true, yeah it's redundant, and it might be clearer to either force the main file to always be first, or force the main file to be explicitly flagged with main=>true even if it is the first file.

Reply to "Real Examples"