test.beforeEach(t => { let root = document.getElementById('root'); if (!root) { root = document.createElement('div'); root.id = 'root'; document.body.appendChild(root); } t.context.root = root; });
updateCPUtemp() { window.si.cpuTemperature().then(data => { try { document.getElementById("mod_cpuinfo_temp").innerText = `${data.max}°C`; } catch(e) { // See above notice } }); }
const unmountDialog = (dialog) => { if (dialog) { dialog.close() document.getElementById(innerDialogID).appendChild(dialog) } }
async function main() { const store = createStore(reducer, applyMiddleware(reduxMiddleware)); console.info('Popup: Init bridge and restore state...'); await bridge().init(window.browser ? window.browser : window.chrome, !!window.browser, store); console.info('Popup: Creating React app...'); ReactDOM.render(<Provider store={store}><App /></Provider>, document.getElementById('root')); }
onLoadIFrame() { let iframe = document.getElementById(this.id); let doc = iframe.contentDocument; doc.body = this.props.body; let styles = window.getComputedStyle(doc.body); let height = parseInt(styles.height) + parseInt(styles.marginTop) + parseInt(styles.marginBottom); // fix max height iframe.height = Math.min(height, ReplConstants.IFRAME_MAX_HEIGHT) + 'px'; doc.body.style.color = (document.body.className.indexOf('dark-theme') !== -1 ? 'whitesmoke' : 'darkslategrey'); }
render(( <Router id="UA-46921629-2"> <Route path="/" render={ props => ( <Site { ...props } import={ path => import(`./content/${path}`) } /> )} /> </Router> ), document.getElementById('root'));
const mountDialog = (dialog) => { if (dialog) { document.getElementById(dialogID).appendChild(dialog) if (typeof HTMLDialogElement === 'function' || !dialog.showModal) { // There is some difference between dialog and its polyfill, and it breaks our layout. // To avoid this issue, always use polyfill. dialogPolyfill.forceRegisterDialog(dialog) } dialog.showModal() } }
render() { const { inPortal } = this.props; return inPortal ? ReactDOM.createPortal(this.renderContent(), document.getElementById('dialog')) : this.renderContent(); }
// react entry point (() => { onLoadSettings(); const repl = document.getElementById('node-repl-plus'); React.render(<Repl />, repl); const suggestion = document.getElementById('node-repl-prompt-suggestions'); React.render(<ReplSuggestions />, suggestion); const preferences = document.getElementById('node-repl-preferences'); React.render(<ReplPreferences />, preferences); })();
const render = (Component) => { ReactDOM.render( <AppContainer> <Component/> </AppContainer>, document.getElementById('root') ); }
updateCPUspeed() { window.si.cpuCurrentspeed().then(data => { try { document.getElementById("mod_cpuinfo_speed_min").innerText = `${data.min}GHz`; document.getElementById("mod_cpuinfo_speed_max").innerText = `${data.max}GHz`; } catch(e) { // See above notice } }); }
updateCPUtasks() { window.si.processes().then(data => { try { document.getElementById("mod_cpuinfo_tasks").innerText = `${data.all}`; } catch(e) { // See above notice } }); }
test.beforeEach(t => { let root = document.getElementById('root'); if (!root) { root = document.createElement('div'); root.id = 'root'; document.body.appendChild(root); } t.context.root = root; });
test.beforeEach(t => { let root = document.getElementById('root'); if (!root) { root = document.createElement('div'); root.id = 'root'; document.body.appendChild(root); } t.context.root = root; });
updateCPUtemp() { window.si.cpuTemperature().then(data => { try { document.getElementById("mod_cpuinfo_temp").innerText = `${data.max}°C`; } catch(e) { // See above notice } }); }