我已经开始为多个平台开发HTML应用程序。最近,我听说了Cordova 2.0(PhoneGap),自那以后我一直很好奇桥梁是如何工作的。 经过大量代码漫步,我发现Exec.js是从JS-> Native调用发生的代码。
execXhr = execXhr || new XMLHttpRequest();
// Changeing this to a GET will make the XHR reach the URIProtocol on 4.2.
// For some reason it still doesn't work though...
execXhr.open('HEAD', "file:///!gap_exec", true);
execXhr.setRequestHeader('vc', cordova.iOSVCAddr);
if (shouldBundleCommandJson()) {
execXhr.setRequestHeader('cmds', nativecomm());
}
execXhr.send(null);
} else {
execIframe = execIframe || createExecIframe();
execIframe.src = "gap://ready";
但是想要理解它是如何工作的,这里的概念是什么,file:///!gap_exec或者gap://ready是什么?调用是如何传播到更低层次(本地代码层)的呢?
提前感谢您的帮助。