_base/kernel._contentHandlers

dojo/_base/kernel._contentHandlers

Summary

A map of available XHR transport handle types. Name matches the handleAs attribute passed to XHR calls.

A map of available XHR transport handle types. Name matches the handleAs attribute passed to XHR calls. Each contentHandler is called, passing the xhr object for manipulation. The return value from the contentHandler will be passed to the load or handle functions defined in the original xhr call.

Examples

Example 1

Creating a custom content-handler:

xhr.contentHandlers.makeCaps = function(xhr){
    return xhr.responseText.toUpperCase();
}
// and later:
dojo.xhrGet({
    url:"foo.txt",
    handleAs:"makeCaps",
    load: function(data){ /* data is a toUpper version of foo.txt */ }
});
登录查看完整内容