#2924 closed enhancement (fixed)
Fix some of the fixmes in _base/xhr.js, and re-org to allow other io transports to use xhr infrastructure
Reported by: | James Burke | Owned by: | alex |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | IO | Version: | 0.4.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Asking Alex to review:
The patch for this ticket fixes some of the fixmes in _base/xhr.js, in particular:
- Preserves the user's input args
- Better timeout support, with a "dojoType" property added to the Error object.
- Make sure we xhr abort on an deferred error callback.
This patch also makes two methods publicly visible so they can be used by other io transports: dojo._ioWatch (was private _launch) and dojo._ioSetArgs (was part of private _setupForXhr).
Attachments (2)
Change History (11)
Changed 15 years ago by
Attachment: | 2924.patch added |
---|
comment:1 Changed 15 years ago by
File sizes of rhino-compressed dojo.js:
before patch: 64238 after patch: 64849
This patch adds 611 bytes.
comment:2 Changed 15 years ago by
Just added 2924-2.patch. This version has support for passing load and error callbacks as part of the args object passed to the public APIs. The load and error callbacks are added to the Deferred object underneath, and when they are called, they have their "this" set to the args object. They also receive the ioArgs as a second argument (the deferred result is the first).
This should make it very easy to make encapsulated IO calls that do not want to hold onto their args objects just so they can add callbacks to the Deferred object. Also, it allows easy access to the args state, since it is the "this" value in those callbacks.
File sizes of rhino-compressed dojo.js:
before patch: 64238 after patch2: 65099
Patch 2 adds 861 bytes compared to the unpatched version. It is 150 bytes larger than Patch 1.
I think that 150 bytes is worth avoiding having to explain Deferreds for the simple use cases (and not to mention the extra bytes the user will have to type to use the Deferreds directly).
This change would also work for the dojo.rpc case (the load and error callbacks are only added to the Deferred if they are functions).
Changed 15 years ago by
Attachment: | 2924-2.patch added |
---|
New version with load/error support, and puts form parsing inside dojo._ioSetArgs
comment:3 Changed 15 years ago by
Just updated Patch 2 -- when trying to use the xhr infrasctructure for dojo.io.script (see ticket #2911), it seemed best to put the form parsing inside dojo._ioSetArgs().
File sizes of rhino-compressed dojo.js:
before patch: 64238 after patch2: 65016
Patch 2 adds 778 bytes compared to the unpatched version. It is 167 bytes larger than Patch 1. (Previous comment said the original Patch 2 was 150 bytes bigger than Patch 1, but that comment should have read "250 bytes bigger").
comment:4 Changed 15 years ago by
(In [8488]) merging the first part James' patch to add ScriptSrc? IO to Core. Refs #2924
comment:5 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
thanks for getting this revved and done. Marking fixed.
Patch file #1