Skip to content

Commit

Permalink
fix(core): fixed nativeFlushQueueImmediate callID issue
Browse files Browse the repository at this point in the history
hoist __GLOBAL__._queue reset logic to avoid duplicated callID sent to nativeFlushQueueImmediate
  • Loading branch information
zoomchan-cxj committed Jun 7, 2021
1 parent 61c63eb commit ea77912
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/js/global/ConsoleModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ const supportApiList = ['log', 'info', 'warn', 'error', 'debug'];

supportApiList.forEach((api) => {
global.console[api] = (...args) => {
const log = args.map(arg => inspect(arg)).join(' ');
consoleModule.Log(log);
if (vmConsole) {
vmConsole[api](...args);
}
const log = args.map(arg => inspect(arg)).join(' ');
consoleModule.Log(log);
};
});

Expand Down
3 changes: 2 additions & 1 deletion core/js/global/ios/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ __GLOBAL__.enqueueNativeCall = (moduleID, methodID, params, onFail, onSucc) => {
__GLOBAL__._queue[2].push(params);

if (typeof nativeFlushQueueImmediate !== 'undefined') {
nativeFlushQueueImmediate(__GLOBAL__._queue);
const originalQueue = [...__GLOBAL__._queue];
__GLOBAL__._queue = [[], [], [], __GLOBAL__._callID];
nativeFlushQueueImmediate(originalQueue);
}
};

Expand Down
2 changes: 1 addition & 1 deletion core/js/global/ios/promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,6 @@ Promise.prototype['catch'] = function (onRejected) {
return this.then(null, onRejected);
};

global.Promise = Promise;
global.Promise = global.Promise || Promise;

/* eslint-disable */
8 changes: 4 additions & 4 deletions core/src/napi/jsc/native_source_code_ios.cc

Large diffs are not rendered by default.

Loading

0 comments on commit ea77912

Please sign in to comment.