Jump to content

User:Cavila/JavaScript

From mediawiki.org

Notes

ResourceLoader clients:

  • mw.loader.load (modules , [type])
  • mw.loader.using (dependencies, [ready], [error]) : to be used if there's a dependency on modules; executes callback function after loading those modules.
  • jQuery.getScript : for callbacks on external scripts
MediaWiki and JavaScript
JavaScript

Delivery

ResourceLoader: delivery system for optimized loading and managing of modules
Core modules, including jQuery and OOjs
API client code

Adding JS on-wiki

Interface (user-specific, group-specific and site-wide)
ContentHandler facility for supporting js as page content
Snippets
Allowing raw html
Extensions that allow you to add js
Extension:Gadgets, Extension:Widgets

Extensions, skins and other modules

ResourceLoader modules
Developing with ResourceLoader
$wgResourceModules, BeforePageDisplay hook
OOUI
Ajax and Ajax extensions

Further guidance

Category for all things JavaScript
Learning JavaScript
CORS
Broken scripts
Core development: coding conventions and unit testing
Techinical docs @doc.wikimedia.org