2018-07-30 18:20:57 +02:00
|
|
|
import loopProtect from 'loop-protect';
|
2018-08-20 20:54:12 +02:00
|
|
|
import { Hook } from 'console-feed';
|
2018-07-30 18:20:57 +02:00
|
|
|
|
|
|
|
window.loopProtect = loopProtect;
|
|
|
|
|
|
|
|
const consoleBuffer = [];
|
|
|
|
const LOGWAIT = 500;
|
|
|
|
Hook(window.console, (log) => {
|
|
|
|
consoleBuffer.push({
|
2018-11-15 23:19:50 +01:00
|
|
|
log,
|
2018-11-15 23:28:43 +01:00
|
|
|
source: 'sketch'
|
2018-07-30 18:20:57 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
setInterval(() => {
|
|
|
|
if (consoleBuffer.length > 0) {
|
|
|
|
window.parent.postMessage(consoleBuffer, '*');
|
|
|
|
consoleBuffer.length = 0;
|
|
|
|
}
|
|
|
|
}, LOGWAIT);
|