feat:fix debugger error when call context before connect to device

This commit is contained in:
pengfei.zhou
2021-03-02 18:19:35 +08:00
committed by osborn
parent 1af0600001
commit f22e0ccf9a
3 changed files with 35 additions and 3 deletions

View File

@@ -147,6 +147,7 @@ function initNativeEnvironment(source) {
});
});
}
global.context = doric.jsObtainContext("FakeContext");
const entryHooks = [];
global.Entry = function () {
var _a, _b, _c;
@@ -168,7 +169,9 @@ global.Entry = function () {
initNativeEnvironment(source).then(ret => {
contextId = ret;
console.log("debugging context id: " + contextId);
global.context = doric.jsObtainContext(contextId);
const realContext = doric.jsObtainContext(contextId);
global.context.id = contextId;
global.context = realContext;
entryHooks.forEach(e => e(contextId));
});
return arguments[0];
@@ -198,4 +201,10 @@ global.nativeLog = (type, msg) => {
}
}
};
global.nativeRequire = () => {
console.error("Do not call nativeRequire here");
};
global.nativeBridge = () => {
console.error("Do not call nativeBridge here");
};
export * from './index';