feat: add console to global runtime
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { uniqueId } from "../util/uniqueId";
|
||||
import { loge } from "../util/log";
|
||||
import { loge, logw, log } from "../util/log";
|
||||
import "reflect-metadata"
|
||||
|
||||
/**
|
||||
@@ -295,6 +295,13 @@ export function jsObtainEntry(contextId: string) {
|
||||
}
|
||||
|
||||
const global = Function('return this')()
|
||||
if (!Reflect.has(global, "console")) {
|
||||
Reflect.set(global, "console", {
|
||||
warn: logw,
|
||||
error: loge,
|
||||
log: log
|
||||
})
|
||||
}
|
||||
let __timerId__ = 1
|
||||
|
||||
const timerInfos: Map<number, { callback: () => void, context?: Context }> = new Map
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { uniqueId } from "../util/uniqueId";
|
||||
import { loge } from "../util/log";
|
||||
import { loge, logw, log } from "../util/log";
|
||||
import "reflect-metadata"
|
||||
|
||||
/**
|
||||
@@ -334,6 +334,13 @@ export function jsObtainEntry(contextId: string) {
|
||||
}
|
||||
|
||||
const global = Function('return this')()
|
||||
if (!Reflect.has(global, "console")) {
|
||||
Reflect.set(global, "console", {
|
||||
warn: logw,
|
||||
error: loge,
|
||||
log: log
|
||||
})
|
||||
}
|
||||
let __timerId__ = 1
|
||||
|
||||
const timerInfos: Map<number, { callback: () => void, context?: Context }> = new Map
|
||||
|
Reference in New Issue
Block a user