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