617f00653c
* init v2 * make replay work * fix a failing scenary of react-frame * fix some bugs * delete/comment some files * remove * fix some bugs && remove more comments * remove unnecessary lines * minor tweak * fix some bugs * try to hook iframe using webpack * update * changes according to cassie * minor tweak * fix lint * extract sass * add icons * update webpack config * update webpack configuration * update * tweak * fix a small bug
21 lines
483 B
JavaScript
21 lines
483 B
JavaScript
import loopProtect from 'loop-protect';
|
|
import Hook from 'console-feed/lib/Hook/index';
|
|
|
|
window.loopProtect = loopProtect;
|
|
|
|
const consoleBuffer = [];
|
|
const LOGWAIT = 500;
|
|
Hook(window.console, (log) => {
|
|
const { method, data: args } = log[0];
|
|
consoleBuffer.push({
|
|
method,
|
|
arguments: args,
|
|
source: 'sketch'
|
|
});
|
|
});
|
|
setInterval(() => {
|
|
if (consoleBuffer.length > 0) {
|
|
window.parent.postMessage(consoleBuffer, '*');
|
|
consoleBuffer.length = 0;
|
|
}
|
|
}, LOGWAIT);
|