Opened 10 years ago

Closed 9 years ago

#9493 closed enhancement (invalid)

big increase flexibility of dojo.io.iframe with little changes

Reported by: remy damour Owned by: James Burke
Priority: high Milestone: future
Component: IO Version: 1.3.1
Keywords: Cc:
Blocked By: Blocking:

Description

Hi,

I am creating my widget, and I found dojo.io.iframe great. Feeding all queries through a single iframe is interesting on certain aspects, but sometimes you might want more than a single iframe (to isolate queries).

=> I tried to create a bulk copy of dojo.io.iframe through: var ioIframe = dojo.mixin({}, dojo.io.iframe, {_currentDfd: null, _dfdQueue: [],_iframeName: this.declaredClass + "IoIframe"});

Ultimately, above code did not work because dojo.io.iframe calls itself with it's hardcoded name.

By making very small changes, you increase a lot its flexibility. Required changes are as follow:

  1. l.169: this._frame = this.create(this._iframeName, dojo._scopeName + ".io.iframe._iframeOnload();");

It would be great to replace 'dojo._scopeName + ".io.iframe._iframeOnload();"' with something like 'this._myName._iframeOnload();"' so that updating live this._myName would do the trick

  1. l. 184: var dii = dojo.io.iframe;

Here I created a dummy variable (var self = this;) and wrapped the entire function in a closure: (function() { return function(xxx) {xxx (make use of 'self')};})()

And that's it. Only two little changes. They increase flexibility a lot!!!!

If I can be of any help, please let me know.

note: the reason I need a 'clone' of dojo.io.iframe (and not a simple iframe) is because I am extending a dojox that rely on such element => to make my changes minimal, I need to serve a clone of dojo.io.iframe

Regards, Remy

Attachments (1)

iframe-rdclonable_rev18622#9493.patch (2.0 KB) - added by remy damour 10 years ago.

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by remy damour

comment:1 Changed 10 years ago by remy damour

I've just attached the patch with appropriate modifs (against rev. 18622). I've made another change not listed in the ticket to ensure appropriate queue gets called (and not dojo.io.iframe queue).

With this patch, I was able to use my own io.iframe clone at little cost with following command line: myIoIframe = dojo.mixin({}, dojo.io.iframe, {_currentDfd: null, _dfdQueue: [],_iframeName:'myIframeName',_myName:'myIoIframe'});

Feel free to comment. Remy

comment:2 Changed 10 years ago by James Burke

Could you expand more on the need for this sort of change? For instance, why not just use dojo.io.iframe to send your requests? Is it because you are creating a new component that is basically dojo.io.iframe plus some extensions? If so, can those extensions just be optional extensions on dojo.io.iframe that are directly mixed in to dojo.io.iframe and only triggered by per-request arguments to dojo.io.iframe?

comment:3 Changed 9 years ago by James Burke

Milestone: tbdfuture
Resolution: invalid
Status: newclosed

Closing for now. Use case for this is unclear. Feel free to reopen with more information on the use case (see questions above). But it probably will not make Dojo 1.4.

Note: See TracTickets for help on using tickets.