pull/11719/head
Rich Harris 2 years ago
parent 0139089169
commit a9ba4225a5

@ -143,7 +143,7 @@
const counters = new Map();
const simple = ['log', 'info', 'dir', 'warn', 'error'];
const commands = [...simple, 'clear', 'table', 'group', 'groupEnd', 'groupCollapsed'];
const commands = [...simple, 'clear', 'group', 'groupEnd', 'groupCollapsed'];
let previous = '';
@ -167,6 +167,15 @@
});
}
intercept('table', (...args) => {
const value = args[0];
if (value && typeof value === 'object') {
send({ action: 'console', level: 'table', args });
} else {
send({ action: 'console', level: 'log', args });
}
});
intercept('time', (label = 'default') => {
timers.set(label, performance.now());
});
@ -243,17 +252,13 @@
return JSON.stringify(args, (key, value) => {
// if we don't do this, our Set/Map from svelte/reactivity would show up wrong in the console
if (value instanceof Map) {
return {
type: 'Map',
value
};
return { type: 'Map', value };
}
if (value instanceof Set) {
return {
type: 'Set',
value
};
return { type: 'Set', value };
}
return value;
});
} catch (error) {

Loading…
Cancel
Save