Skip to content

Commit

Permalink
fix: vue3 support ionic-team#4506
Browse files Browse the repository at this point in the history
  • Loading branch information
bazuka5801 committed Apr 27, 2021
1 parent b48b256 commit 0cc9970
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/native-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,19 @@ const initBridge = (w: any): void => {
);
};

const safeStringify = (value: any): string => {
const seen = new Set()
return JSON.stringify(value, (_k, v) => {
if (seen.has(v)) { return '...' }
if (typeof v === 'object') { seen.add(v) }
return v
})
}

const serializeConsoleMessage = (msg: any): string => {
if (typeof msg === 'object') {
try {
msg = JSON.stringify(msg);
msg = safeStringify(msg);
} catch (e) {
// ignore
}
Expand Down

0 comments on commit 0cc9970

Please sign in to comment.