"Helder.wiki" posted a comment on MediaWiki.r107011.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/107011#c31471

Commit summary for MediaWiki.r107011:

[mediawiki.api] clean up

* Adding return values to most of the ajax functions so that the jqXHR object 
(originally returned by jQuery.ajax) is available. Some functions documented 
they already did this, some don't. Now they all do and are also documented as 
such.

* Renaming a few 'callback' arguments to 'success' to avoid confusion with 
'error'.

* Removed unused variables
** mw.Api's instance this.url was unused
** var cachedToken was unused in mediawiki.api.titleblacklist.js

* Making closure argument order the same and referencing mediaWiki as a global 
(mw is something thought not to be a global but mediaWiki certainly is, no need 
to access window from the global scope and then the mediaWiki property of it). 
Also renamed any used of $j to $. Adding 'undefined' to the closure arguments 
where missing.

* Re-written the mw.Api constructor's logic for options. Now keeping a 
defaultOptions privately "statically" cached outside the constructor and using 
that to build the options object.

* Made all non-block comments the same comment style (some were /* */ or /* \n 
*/)

* Completed parameter documentation and wrote TODO as @todo and added an 
example use for mw.Api in the documentation.

* Some other random whitespacing, line breaking, merged var statement, and 
moved them out of blocks (since JS doesn't have block scope) into the main 
function body for clarity. And some other random JS Lint/JS Hint stuff.

* Added comment to api.titleblacklist module about the module not being in core 
but in the TitleBlacklist extension.

Helder.wiki's comment:

Isn't slightly better to change part of normalizeAjaxOptions to
<pre>var opt = typeof arg === 'function' ? { 'ok': arg }: arg;</pre>
or to
<pre>var opt;
if ( typeof arg === 'function' ) {
        opt = { 'ok': arg };
} else {
        opt = arg;
}
</pre>

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to