mediawiki.api: Use then() in getToken instead of manual Deferred wrapping
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 15 May 2014 00:05:57 +0000 (02:05 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 15 May 2014 00:05:57 +0000 (02:05 +0200)
commitd4a63b937e64290b0a4024645f36381d34267a95
tree88a46fa8c519bdcc1d233059581c461a9b78fe99
parent5b915d721c75695c776af71f74687f12e48a2290
mediawiki.api: Use then() in getToken instead of manual Deferred wrapping

* Use then() instead of done()/fail() with a manually created
  Deferred as wrapper. This also makes the passing on of the
  error more explicit.

* Store promises with an abort handler instead of Deferreds, so
  that we don't need to call "d.promise( { abort: d.abort } )"
  again on each return to re-attach the abort, simply do it right
  the first time. We don't need to store the Deferred's handlers
  since only the closure of the caller needs access to
  resolve/reject it. The cached one only needs to be a promise.

* Rename relevant variables to avoid further confusion.

Change-Id: If8995ede271746580c3f2eb0b4a6ecd79e90c7d5
resources/src/mediawiki.api/mediawiki.api.js