feat:fix debugger error when call context before connect to device
This commit is contained in:
parent
1af0600001
commit
f22e0ccf9a
@ -4347,6 +4347,7 @@ function initNativeEnvironment(source) {
|
||||
});
|
||||
});
|
||||
}
|
||||
global$1.context = jsObtainContext("FakeContext");
|
||||
const entryHooks = [];
|
||||
global$1.Entry = function () {
|
||||
var _a, _b, _c;
|
||||
@ -4368,7 +4369,9 @@ global$1.Entry = function () {
|
||||
initNativeEnvironment(source).then(ret => {
|
||||
contextId = ret;
|
||||
console.log("debugging context id: " + contextId);
|
||||
global$1.context = jsObtainContext(contextId);
|
||||
const realContext = jsObtainContext(contextId);
|
||||
global$1.context.id = contextId;
|
||||
global$1.context = realContext;
|
||||
entryHooks.forEach(e => e(contextId));
|
||||
});
|
||||
return arguments[0];
|
||||
@ -4398,6 +4401,12 @@ global$1.nativeLog = (type, msg) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
global$1.nativeRequire = () => {
|
||||
console.error("Do not call nativeRequire here");
|
||||
};
|
||||
global$1.nativeBridge = () => {
|
||||
console.error("Do not call nativeBridge here");
|
||||
};
|
||||
|
||||
exports.AnimationSet = AnimationSet;
|
||||
exports.BOTTOM = BOTTOM;
|
||||
|
@ -16,6 +16,7 @@
|
||||
import * as doric from './src/runtime/sandbox'
|
||||
import WebSocket from "ws"
|
||||
import path from 'path'
|
||||
import { BridgeContext } from './src/runtime/global';
|
||||
|
||||
type MSG = {
|
||||
type: "D2C" | "C2D" | "C2S" | "D2S" | "S2C" | "S2D",
|
||||
@ -136,6 +137,7 @@ async function initNativeEnvironment(source: string) {
|
||||
})
|
||||
}
|
||||
|
||||
global.context = doric.jsObtainContext("FakeContext");
|
||||
const entryHooks: Function[] = []
|
||||
global.Entry = function () {
|
||||
if (!!contextId) {
|
||||
@ -157,7 +159,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];
|
||||
@ -192,4 +196,14 @@ global.nativeLog = (type: string, msg: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
global.nativeRequire = () => {
|
||||
console.error("Do not call nativeRequire here");
|
||||
return false;
|
||||
}
|
||||
|
||||
global.nativeBridge = () => {
|
||||
console.error("Do not call nativeBridge here");
|
||||
return false;
|
||||
}
|
||||
|
||||
export * from './index'
|
@ -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';
|
||||
|
Reference in New Issue
Block a user