resourceloader: Make cache-eval in mw.loader.work asynchronous
* Add 'if !batch.length' in work() to avoid needless initialisation
of mw.loader.store(). work() can be called without anything in
the batch because using() will call enqueue() for any non-ready
modules in order to get a job callback. This will invoke
work() as side-effect but will have no work to do.
This was previously here but got moved in
488c5d9.
* Add 'if !implementations.length' to avoid needless scheduling
of an idle callback when none of the modules in the batch
are found in local storage (e.g. first view).
Bug: T142129
Change-Id: Icd39423aec35f25162d2443b1f0507f6f0c748a3