wikibits: Mark importScript/importStylesheet utilities as deprecated
authorSchnark <listenleser@gmail.com>
Sat, 11 Apr 2015 08:07:54 +0000 (08:07 +0000)
committerTimo Tijhof <krinklemail@gmail.com>
Mon, 13 Apr 2015 18:15:46 +0000 (19:15 +0100)
commit5c5e09016d6b9b2d3d4799a9a34344a8cc96726f
treebde456c646435c04f472cf65db14f66a72fca399
parentf074a738b2684cadc27f600988d571ac19a6641e
wikibits: Mark importScript/importStylesheet utilities as deprecated

The global variable loadedScripts and the import functions from wikibits.js
have been deprecated since 1.17 [1].

The global loadedScripts is used to keep track which scripts have
been loaded through importScriptURI. To do this, it only needs to be
a local variable, not a global.

For scripts using the global to check whether a particular script
has been loaded, here are some possible substitutes:

* Use mw.loader.getState() for scripts loaded through ResourceLoader
  (which includes Gadgets).
* Use hooks (mw.hook) to communicate between the scripts.
* Use $( 'script[src="..."]' ).length to check whether a script with
  a specific URL has been loaded.
* Use $( 'script[src]' ) for a list of all scripts (excluding inline
  scripts), and filter it for whatever you are looking for.

The functions importScriptURI and importStylesheetURI are used to
load scripts and stylesheets resp. from a URI. Use mw.loader.load() instead.
Note that there are minor differences between the deprecated functions
and mw.loader.load(), see [1] for details.

The importScript and importStylesheet shortcuts have been deprecated as well.

[1] https://www.mediawiki.org/wiki/RL/LJS#wikibits.js

Change-Id: Icc87243a8213841bfe46e48a9c074301c241041c
RELEASE-NOTES-1.25
resources/src/mediawiki.legacy/wikibits.js