How to use the console-feed.Hook function in console-feed

To help you get started, we’ve selected a few console-feed examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HendrixString / adobe-cep-react-create / src / client-src / comps / Debug.jsx View on Github external
componentDidMount() {
        // iniitial logz
        const { rawLogz } = this.props

        // also listen
        Hook(window.console, (log) => {
            this.setState((state) => {
                var logz = state.logs.slice()
                logz.push(Decode(log))
                return {
                    logs: logz
                }

            })

        })

        // replay initial logs
        console.log(...rawLogz)
    }
github devuxd / SeeCodeRun / scr-app / src / components / Console.js View on Github external
hookConsole = (console = window.console) => {
        Hook(console, (log) => {
            this.setState((prevState) => {
                    //preservelog
                    const nextState = update(prevState, {logs: {$push: [Decode(log)]}});
                    this.totalMatches = nextState.logs.length;
                    return nextState;
                }
            )
        });


        this.listener = listen(this.handleMessage);
    };
github status-im / liquid-funding / src / components / MainCointainer.jsx View on Github external
const enableLogs = () => {
    Hook(window.console, log => {
      setLogs(logs => ([Decode(log), ...logs]))
    })
  }
github mxmzb / react-marquee-slider / example / src / components / playground.js View on Github external
useEffect(() => {
    Hook(window.console, log => {
      if (log[0].method !== "warn") {
        setLogs(state => [...state, Decode(log)]);
      }
    });
  }, []);
github processing / p5.js-web-editor / client / utils / previewEntry.js View on Github external
import loopProtect from 'loop-protect';
import { Hook } from 'console-feed';

window.loopProtect = loopProtect;

const consoleBuffer = [];
const LOGWAIT = 500;
Hook(window.console, (log) => {
  consoleBuffer.push({
    log,
    source: 'sketch' 
  });
});
setInterval(() => {
  if (consoleBuffer.length > 0) {
    window.parent.postMessage(consoleBuffer, '*');
    consoleBuffer.length = 0;
  }
}, LOGWAIT);

console-feed

A React component that displays console logs from the current page, an iframe or transported across a server

MIT
Latest version published 8 months ago

Package Health Score

61 / 100
Full package analysis