@advanced-rest-client/arc-electron-sources-manager
v0.1.0-rc8
Published
A package to handle ARC preferences state in both rendered and main process
Downloads
86
Keywords
Readme
ARC Electron sources manager
Resolves paths to application source files and themes based on theme.
Usage
$ npm i @advanced-rest-client/electron-driveIn the main process:
const {SourcesManager} = require('@advanced-rest-client/arc-electron-sources-manager/main');
const {ArcPreferences} = require('@advanced-rest-client/arc-electron-preferences');
const startupOptions = {}; // Application start up options.
const prefs = new ArcPreferences();
const manager = new SourcesManager(prefs, startupOptions);
manager.listen();To get paths configuration for the renderer window
prefs.getAppConfig()
.then((config) => {
console.log(config);
// {
// "appComponents": "Location to app component main directory",
// "importFile": "Location of the app sources import file"
// "themeFile": "Location of theme definition"
// }
});Renderer process
const {ThemeManager} = require('@advanced-rest-client/arc-electron-sources-manager/renderer');
const mgr = new ThemeManager();
mgr.listen();The manager gives access to:
listThemes()- lists all installed themesreadActiveThemeInfo()- reads activated theme infoactivate(themeId)- Activates new themeloadTheme(themeLocation)- Loads theme file and activates it.
It listens for the following web custom events:
themes-list- callslistThemes(), adds call result todetail.resulttheme-active-info- callsreadActiveThemeInfo(), adds call result todetail.resulttheme-activate- callsactivate(event.detail.theme), adds call result todetail.result
