https://bugzilla.wikimedia.org/show_bug.cgi?id=36783

       Web browser: ---
             Bug #: 36783
           Summary: JavaScript mw.api.prototype.ajax should return an
                    instance of jQuery.Deferred rather than jqXHR
           Product: MediaWiki
           Version: 1.20-git
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: JavaScript
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---


mw.api.prototype.ajax and mw.api.prototype.post in JavaScript are offering
'err' and 'ok' in the ajaxOptions parameter to specify callbacks for error and
success.
It might be worth replacing this with the use of jQuery.Deferred, so instead of
returning the jqXHR objectd they could return a new Deferred object so one can
assign several callbacks to them.
The jqXHR object shouldn't be of interest much I assume since it only tells
about the ajax requests state and whether it failed, not about the api calls
success. So the ajax can succeed but the api request could still have failed,
this is not apparent when using the jqXHR object.

If people use the jqXHR for some reason code could break if we would change the
return values.
Right now the 'ok' option is obligatory, we could change that so it isn't
anymore and if it isn't provided, we would just return a custom deferred
object.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to