How to use the electron-better-ipc.on function in electron-better-ipc

To help you get started, we’ve selected a few electron-better-ipc 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 atomiclabs / hyperdex / app / menu.js View on Github external
{
			role: 'help',
			submenu: createHelpMenu(),
		},
	];

	const template = is.macos ? macosTemplate : otherTemplate;

	if (isDevelopment) {
		template.push(createDebugMenu());
	}

	Menu.setApplicationMenu(Menu.buildFromTemplate(template.filter(Boolean)));
};

ipc.on('app-container-state-updated', (event, state) => {
	createAppMenu({
		// TODO: Get the logged in state from the container
		isLoggedIn: state.activeView !== 'Login' && state.activeView !== 'AppSettings',
		activeView: state.activeView,
	});
});

module.exports = createAppMenu;
github atomiclabs / hyperdex / app / renderer / containers / App.js View on Github external
if (options.activeView) {
			ipc.callMain('set-active-view-on-dom-ready', options.activeView);
		}

		location.reload();
	}

	async stopMarketmaker() {
		await this.api.stop();
		await ipc.callMain('stop-marketmaker');
	}
}

const appContainer = new AppContainer();

ipc.on('log-out', () => {
	appContainer.logOut();
});

ipc.on('set-active-view', (event, view) => {
	// This is needed for now as we don't have a good way to flow state up to the main process
	// TODO: In the future we should fix this, but not important now
	if (view === 'Settings' && !appContainer.isLoggedIn) {
		view = 'AppSettings';
	}

	appContainer.setActiveView(view);
});

ipc.on('set-next-view', () => {
	appContainer.setNextView();
});
github atomiclabs / hyperdex / app / renderer / containers / App.js View on Github external
ipc.on('set-active-view', (event, view) => {
	// This is needed for now as we don't have a good way to flow state up to the main process
	// TODO: In the future we should fix this, but not important now
	if (view === 'Settings' && !appContainer.isLoggedIn) {
		view = 'AppSettings';
	}

	appContainer.setActiveView(view);
});

ipc.on('set-next-view', () => {
	appContainer.setNextView();
});

ipc.on('set-previous-view', () => {
	appContainer.setPreviousView();
});

if (isDevelopment) {
	window._config = electron.remote.require('./config');
}

let prevState = appContainer.state;
appContainer.subscribe(() => {
	// TODO: This can be removed when the update issue is fixed in Electron:
	// https://github.com/electron/electron/issues/12636
	if (appContainer.state.activeView === prevState.activeView) {
		return;
	}

	prevState = appContainer.state;
github atomiclabs / hyperdex / app / renderer / containers / App.js View on Github external
ipc.on('log-out', () => {
	appContainer.logOut();
});

ipc.on('set-active-view', (event, view) => {
	// This is needed for now as we don't have a good way to flow state up to the main process
	// TODO: In the future we should fix this, but not important now
	if (view === 'Settings' && !appContainer.isLoggedIn) {
		view = 'AppSettings';
	}

	appContainer.setActiveView(view);
});

ipc.on('set-next-view', () => {
	appContainer.setNextView();
});

ipc.on('set-previous-view', () => {
	appContainer.setPreviousView();
});

if (isDevelopment) {
	window._config = electron.remote.require('./config');
}

let prevState = appContainer.state;
appContainer.subscribe(() => {
	// TODO: This can be removed when the update issue is fixed in Electron:
	// https://github.com/electron/electron/issues/12636
	if (appContainer.state.activeView === prevState.activeView) {
github atomiclabs / hyperdex / app / renderer / containers / App.js View on Github external
location.reload();
	}

	async stopMarketmaker() {
		await this.api.stop();
		await ipc.callMain('stop-marketmaker');
	}
}

const appContainer = new AppContainer();

ipc.on('log-out', () => {
	appContainer.logOut();
});

ipc.on('set-active-view', (event, view) => {
	// This is needed for now as we don't have a good way to flow state up to the main process
	// TODO: In the future we should fix this, but not important now
	if (view === 'Settings' && !appContainer.isLoggedIn) {
		view = 'AppSettings';
	}

	appContainer.setActiveView(view);
});

ipc.on('set-next-view', () => {
	appContainer.setNextView();
});

ipc.on('set-previous-view', () => {
	appContainer.setPreviousView();
});
github npezza93 / archipelago / app / main / listeners.js View on Github external
profileManager.find(id).set(prefName, prefValue)
  })

  ipc.answerRenderer('set-pref', ({prefName, prefValue}) => {
    profileManager.set(prefName, prefValue)
  })

  ipc.answerRenderer('set-active-profile', activeProfileId => {
    profileManager.activeProfileId = activeProfileId
  })

  ipc.on('activeProfileId', event => {
    event.returnValue = profileManager.activeProfile().id
  })

  ipc.on('profiles', event => {
    event.returnValue = profileManager.all()
  })

  ipc.answerRenderer('open-hamburger-menu', args => Menu.getApplicationMenu().popup(args))
}
github npezza93 / archipelago / app / main / listeners.js View on Github external
profiles: profileManager.all()}
  })

  ipc.answerRenderer('set-profile-pref', ({id, prefName, prefValue}) => {
    profileManager.find(id).set(prefName, prefValue)
  })

  ipc.answerRenderer('set-pref', ({prefName, prefValue}) => {
    profileManager.set(prefName, prefValue)
  })

  ipc.answerRenderer('set-active-profile', activeProfileId => {
    profileManager.activeProfileId = activeProfileId
  })

  ipc.on('activeProfileId', event => {
    event.returnValue = profileManager.activeProfile().id
  })

  ipc.on('profiles', event => {
    event.returnValue = profileManager.all()
  })

  ipc.answerRenderer('open-hamburger-menu', args => Menu.getApplicationMenu().popup(args))
}