Opened 10 years ago

Closed 10 years ago

#8707 closed enhancement (fixed)

expose dojo._contentHandlers

Reported by: dante Owned by: dante
Priority: high Milestone: 1.4
Component: General Version: 1.3.0b1
Keywords: Cc: James Burke, Eugene Lazutkin
Blocked By: Blocking:

Description

I'd like to suggest we expose the XHR contenthandlers map used to process incoming XHR content. Neil's (pottedmeat) article explains the usecase:

http://www.sitepen.com/blog/2008/04/14/xhr-plugins-with-dojo-using-handleas/

something so we could formalize this plugin process and allow for things like:

dojo.xhrGet({
  url:"file.txt", handleAs:"populate", node:"someId"
});

provided the user wanted to create a 'populate xhr plugin'.

Attachments (1)

xhr-ch.patch (10.3 KB) - added by dante 10 years ago.
fix for this issue. expanded docs, minor minor code altering

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by dante

Owner: changed from anonymous to dante
Status: newassigned

I'm going to go ahead and do this. same stuff as other _privates: expose + alias, then document.

Changed 10 years ago by dante

Attachment: xhr-ch.patch added

fix for this issue. expanded docs, minor minor code altering

comment:2 Changed 10 years ago by dante

Cc: James Burke Eugene Lazutkin added

I've attached a fix for the exposing, would love a review. reduced "dojopublish?" down to one reference, added lots of docs, moved stuff around.

comment:3 Changed 10 years ago by James Burke

Looks good to me overall. I avoided creating a local alias for _d.publish because I was trying to allow for it to come in later, like as part of a custom base install that pulls in the event code after the layer that brings in this XHR code.

So I favored the dynamic checks. Although I should have just used the _d.publish syntax instead of the goofy _dpublish? version.

But I am open to reconsideration on that, if you think there are compelling reasons to only do the check on module load. Otherwise, the patch with the change to using _d.publish instead of publish is good for me.

comment:4 in reply to:  3 Changed 10 years ago by Eugene Lazutkin

Looks good. Probably, like James suggested, we are better off reverting to _d.publish --- I don't think it has any meaningful performance implications in this particular context.

comment:5 Changed 10 years ago by dante

Resolution: fixed
Status: assignedclosed

(In [20221]) fixes #8707 - exposing _contentHandlers, adding docs, keeping alias. added to wiki docs

Note: See TracTickets for help on using tickets.