mediawiki.api: Use Promise.then instead of manual Deferred wrap
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 5 Mar 2014 13:25:29 +0000 (14:25 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Sun, 16 Mar 2014 21:24:00 +0000 (22:24 +0100)
commit12251c76f720dd168dfcc361f0685045e846ab7d
treea9324e6dd68abaefe5be6aa3c9c0e14de99b47a1
parentb4b8216df896636f887dbc7d95f568e41760b7c0
mediawiki.api: Use Promise.then instead of manual Deferred wrap

This is exactly what Promise.then is built for.

As a nice bonus, this way the fail/reject handler is transferred
automatically, and we don't need to call resolve() manually
since the return value from then(Function done) is the resolved
value (or another promise).

Minor clean up:

* category: Fix type documentation (primitive string instead of String object).
* category: Use simple boolean check to assert value is no longer false.
* Use String() cast instead of explicitly calling .toString.
* parse: Fix bug where in theory the deferred would never be resolved if
   the condition evaluated to false.
* watch: Add missing @static.
* watch: Simplify params/$.extend logic.

Change-Id: Iedbc70b2573c4f6b0d9e133c6f31e8f0b19c6f5e
resources/mediawiki.api/mediawiki.api.category.js
resources/mediawiki.api/mediawiki.api.edit.js
resources/mediawiki.api/mediawiki.api.js
resources/mediawiki.api/mediawiki.api.parse.js
resources/mediawiki.api/mediawiki.api.watch.js