class Bridge { constructor(electronWrapper) { this.electronWrapper_ = electronWrapper; } processArgv() { return process.argv; } window() { return this.electronWrapper_.window(); } windowContentSize() { if (!this.window()) return { width: 0, height: 0 }; const s = this.window().getContentSize(); return { width: s[0], height: s[1] }; } showMessageBox(options) { const {dialog} = require('electron'); return dialog.showMessageBox(options); } } let bridge_ = null; function initBridge(wrapper) { if (bridge_) throw new Error('Bridge already initialized'); bridge_ = new Bridge(wrapper); return bridge_; } function bridge() { if (!bridge_) throw new Error('Bridge not initialized'); return bridge_; } module.exports = { bridge, initBridge }