mediawiki.js: clean-ups
authorOri Livneh <ori@wikimedia.org>
Tue, 10 Mar 2015 06:57:33 +0000 (23:57 -0700)
committerOri Livneh <ori@wikimedia.org>
Wed, 11 Mar 2015 18:25:29 +0000 (11:25 -0700)
commiteece5d6b76797f849592689c84cd649b1937c5fe
tree1703f2e0a1985c7706aed0c41a960951150eb5a7
parent612092a512fb5f8ac02ce2fc4da6fabc4db472cf
mediawiki.js: clean-ups

* Inline canExpandStylesheetWith().
* Make resolve() take an array of module names instead of being flexible
  (taking either a string or an array). It's a private method, so it doesn't
  need to have a cute API.
* Use simple string concatenation rather than [].join in pad()
* Make allReady() more efficient by having it bail early as soon as any
  non-ready module is encountered.
* Add anyFailed(), which is a complement to allReady().
* Remove filter(). In more than one place, it was used to check whether a
  module in some specified state existed in a list of modules, which is
  inefficient, since filter() continues iterating through the array of modules
  after finding a match and because it constructed an array with the matches,
  which was not needed.
* Replace some verbose array iteration with $.grep / $.map / $.each.

Change-Id: I22a2f824488ba39d03b546ac8560f551a3198d7f
resources/src/mediawiki/mediawiki.js