get-debug.js revision f708d7565966b0cf46ee594efc3097461dfe9260
/**
* NodeJS specific Get module used to load remote resources. It contains the same signature as the default Get module so there is no code change needed.
* Note: There is an added method called Get.domScript, which is the same as Get.script in a browser, it simply loads the script into the dom tree
* so that you can call outerHTML on the document to print it to the screen.
* @module get-nodejs
*/
//Y.log('Get end: ' + cb.onEnd);
}
//Y.log('Get pass: ' + cb.onSuccess);
}
//Y.log('Get fail: ' + er);
}
};
Y.Get = function() {};
/**
* Override for Get.script for loading local or remote YUI modules.
*/
var A = Y.Array,
for (i=0; i<l; i++) {
include(url, function(err) {
if (!Y.config) {
Y.config = {
debug: true
};
}
if (err) {
if (err.stack) {
A.each(err.stack.split('\n'), function(frame) {
});
} else {
console.log(err);
}
} else {
pass(cb);
}
});
}
};
var urlInfoPort = function(urlInfo) {
return urlInfo.port ? parseInt(urlInfo.port, 10) :
};
var exec = function(data, url, cb) {
var mod = "(function(YUI) { " + data + ";return YUI; })";
var script = vm.createScript(mod, url);
var fn = script.runInThisContext(mod);
YUI = fn(YUI);
cb(null);
};
var include = function(url, cb) {
if (url.match(/^https?:\/\//)) {
var u = n_url.parse(url, parseQueryString=false),
p = urlInfoPort(u),
req_url = u.pathname;
if (u.search) {
req_url += u.search;
}
var h = http;
h = https;
}
h.get({
host: u.hostname,
port: p,
path: req_url
}, function(res) {
var mod = '';
mod += chunk;
});
exec(mod, url, cb);
});
});
} else {
exec(mod, url, cb);
});
}
};