@@ -30,18 +30,6 @@ function sendConsoleMessages(messages: Message[]) {
30
30
)
31
31
}
32
32
33
- if ( __HARMONY_JSVM__ ) {
34
- if (
35
- typeof UTSProxyObject === 'object' &&
36
- UTSProxyObject !== null &&
37
- typeof UTSProxyObject . invokeSync === 'function'
38
- ) {
39
- UTSProxyObject . invokeSync ( '__UniConsole' , 'setSendConsoleMessages' , [
40
- sendConsoleMessages ,
41
- ] )
42
- }
43
- }
44
-
45
33
export function setSendConsole ( value : SendFn , extra : Record < string , any > = { } ) {
46
34
sendConsole = value
47
35
Object . assign ( messageExtra , extra )
@@ -55,6 +43,17 @@ export function setSendConsole(value: SendFn, extra: Record<string, any> = {}) {
55
43
const atFileRegex = / ^ \s * a t \s + [ \w / . / - ] + : \d + $ /
56
44
57
45
export function rewriteConsole ( ) {
46
+ if ( __HARMONY_JSVM__ ) {
47
+ if (
48
+ typeof UTSProxyObject === 'object' &&
49
+ UTSProxyObject !== null &&
50
+ typeof UTSProxyObject . invokeSync === 'function'
51
+ ) {
52
+ UTSProxyObject . invokeSync ( '__UniConsole' , 'setSendConsoleMessages' , [
53
+ sendConsoleMessages ,
54
+ ] )
55
+ }
56
+ }
58
57
function wrapConsole ( type : MessageType ) {
59
58
return function ( ...args : any [ ] ) {
60
59
const originalArgs = [ ...args ]
@@ -113,7 +112,17 @@ export function rewriteConsole() {
113
112
}
114
113
}
115
114
}
116
- return function restoreConsole ( ) { }
115
+ return function restoreConsole ( ) {
116
+ if ( __HARMONY_JSVM__ ) {
117
+ if (
118
+ typeof UTSProxyObject === 'object' &&
119
+ UTSProxyObject !== null &&
120
+ typeof UTSProxyObject . invokeSync === 'function'
121
+ ) {
122
+ UTSProxyObject . invokeSync ( '__UniConsole' , 'restoreConsole' , [ ] )
123
+ }
124
+ }
125
+ }
117
126
}
118
127
119
128
function isConsoleWritable ( ) {
0 commit comments