How to use the scratch-gui/dist/scratch-gui.AppStateHOC function in scratch-gui

To help you get started, we’ve selected a few scratch-gui 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 LLK / scratch-desktop / src / renderer / index.jsx View on Github external
import React from 'react';
import ReactDOM from 'react-dom';

import GUI, {AppStateHOC} from 'scratch-gui/dist/scratch-gui';
import styles from 'scratch-gui/src/playground/index.css';

// Register "base" page view
// analytics.pageview('/');

const appTarget = document.getElementById('app');
appTarget.className = styles.app || 'app'; // TODO
document.body.appendChild(appTarget);

GUI.setAppElement(appTarget);
const WrappedGui = AppStateHOC(GUI);

if (process.env.NODE_ENV === 'production' && typeof window === 'object') {
    // Warn before navigating away
    window.onbeforeunload = () => true;
}

ReactDOM.render(, appTarget);