| 1 |
define(["dojo/_base/kernel", "dojo/_base/window", "dojo/io/script", "dojox/io/xhrPlugins", "dojox/io/scriptFrame"], function(dojo, window, script, xhrPlugins, scriptFrame){ |
| 2 |
dojo.getObject("io.xhrScriptPlugin", true, dojox); |
| 3 |
|
| 4 |
dojox.io.xhrScriptPlugin = function(url, callbackParamName, httpAdapter){ |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
xhrPlugins.register( |
| 16 |
"script", |
| 17 |
function(method,args){ |
| 18 |
return args.sync !== true && |
| 19 |
(method == "GET" || httpAdapter) && |
| 20 |
(args.url.substring(0,url.length) == url); |
| 21 |
}, |
| 22 |
function(method,args,hasBody){ |
| 23 |
var send = function(){ |
| 24 |
args.callbackParamName = callbackParamName; |
| 25 |
if(dojo.body()){ |
| 26 |
args.frameDoc = "frame" + Math.random(); |
| 27 |
} |
| 28 |
return script.get(args); |
| 29 |
}; |
| 30 |
return (httpAdapter ? httpAdapter(send, true) : send)(method, args, hasBody); |
| 31 |
} |
| 32 |
); |
| 33 |
}; |
| 34 |
|
| 35 |
return dojox.io.xhrScriptPlugin; |
| 36 |
}); |