Skip to content

Reference ​

ts
import { createAppIpc, createAppScheme, createTheme, createUpdater, createWindows, createWindowState } from '@adecore/shell';
import { ipcSubscriber, type MenuSpec, type ThemeState, type UpdateState } from '@adecore/shell/bridge';

Options ​

App scheme lists the options of createAppScheme.

UpdaterOptions ​

OptionType
currentVersionstringThe running version, such as app.getVersion().
packagedbooleanFalse in a checkout, which has no feed.
load() => AppUpdaterLoads electron-updater's autoUpdater. Called only when packaged.
publish(state: UpdateState) => voidEvery change of the state.
beforeCheck() => void, optionalRight before each check.
onQuit(quitting: boolean) => void, optionalTrue right before an install quits, false when it failed. Pass windows.quitForUpdate.
silentInstallboolean, optionalWindows only: no installer windows, and the app starts again after.
log(message, error) => void, optionalFailures. console.error by default.
setInterval(run, ms) => unknown, optionalThe hourly timer, for tests.

The Updater it returns has state(), start(), configure(autoDownload), check(), download(), install() and setAllowPrerelease(allow).

WindowsOptions ​

OptionType
stateWindowStateFrom createWindowState.
sessionWindowStateStorageWhich windows were open at the last quit, such as a fileStorage.
create(key, bounds, origin, state) => BrowserWindowBuilds and loads a window.
onFront(window) => void, optionalA window came to the front.
formerKeystring, optionalThe key a single window used to keep its bounds under.
platformNodeJS.Platform, optionalprocess.platform by default.
setTimeout(run, ms) => unknown, optionalThe timer that asks for a confirmed quit again, for tests.

The Windows it returns has open, restore, claim, move, hold, detach, transfer, holderOf, windowAt, setState, fromPage, fromContents, focused, keyOf, all, send, attach, quit, resume and quitForUpdate. Windows and Quitting explain each.

WindowStateOptions ​

OptionType
storageWindowStateStorageWhere the bounds live, such as fileStorage(path).
displays() => readonly WindowDisplay[]screen.getAllDisplays, asked at every open.
defaultsWindowSizeThe size of a window with nothing saved.
delayMsnumber, optionalHow long a window stands still before a write. 500 by default.
setTimeout, clearTimeoutoptionalThe write timer, for tests.

The WindowState it returns has bounds(key, fallback?), track(key, window), has(key) and flush().

ThemeOptions ​

OptionType
nativeThemePick<NativeTheme, 'themeSource'>Electron's nativeTheme.
windows() => readonly BrowserWindow[]The windows to paint.
backgroundstringA window's background before any page reported one.
overlayTitleBarOverlay, optionalOff macOS, the height of the controls drawn over the page and their colors per theme.
nativeFrameboolean, optionalOff macOS, the system's own title bar instead.
trafficLights{ x, y }, optionalWhere macOS puts the traffic lights. { x: 17, y: 17 } by default.
platformNodeJS.Platform, optionalprocess.platform by default.

The Theme it returns has apply(state), current() and windowOptions().

MenuTemplateOptions
run(id, byKey)A picked command; byKey when its accelerator fired it.
shellItem(action, label)What the shell draws for one of its own actions, or null.
platformOptional, process.platform by default.
MenuCommandOptions
pageKeysFrom createPageKeys.
window()The window whose page runs a command, a MenuWindow.
keyBypassesPage()Optional. True while the keyboard is in a page that never passes keys on.
StaticMenuOptions
appNameThe name of the app menu on macOS.
toggleDevTools()Runs from the View menu.
appItemsOptional. At the top of the app menu on macOS.
quitItemsOptional. Right above Quit.
fileItemsOptional. A File menu of their own on macOS, the top of the File menu elsewhere.
platformOptional, process.platform by default.

Exports ​

Every name each entry point exports, read from its source. Anything not listed is internal and may change in any release.

@adecore/shell ​

The main process: menu, updater, windows, window state, theme, app scheme and guards.

NameKindSource
createAppIpcfunctionapp-ipc
AppIpctypeapp-ipc
createAppSchemefunctionapp-scheme
segmentsOffunctionapp-scheme
AppSchemetypeapp-scheme
AppSchemeOptionstypeapp-scheme
SchemeFoldertypeapp-scheme
SchemeResolvertypeapp-scheme
createMenuCommandsfunctionmenu
devToolsAcceleratorfunctionmenu
menuTemplateOfconstmenu
staticMenuTemplatefunctionmenu
MenuCommandOptionstypemenu
MenuTemplateOptionstypemenu
MenuWindowtypemenu
StaticMenuOptionstypemenu
createPageKeysfunctionpage-keys
PageKeytypepage-keys
PageKeystypepage-keys
createUpdaterfunctionupdater
Updatertypeupdater
UpdaterOptionstypeupdater
appWindowNavigationfunctionweb-guards
createGestureGatefunctionweb-guards
isAppSenderfunctionweb-guards
isAppUrlfunctionweb-guards
isExternalLinkfunctionweb-guards
isWebLinkfunctionweb-guards
originOffunctionweb-guards
GestureGatetypeweb-guards
NavigationVerdicttypeweb-guards
SenderFrametypeweb-guards
createWindowStatefunctionwindow-state
fileStoragefunctionwindow-state
SavedWindowtypewindow-state
StateWindowtypewindow-state
WindowDisplaytypewindow-state
WindowSizetypewindow-state
WindowStatetypewindow-state
WindowStateOptionstypewindow-state
WindowStateStoragetypewindow-state
createThemefunctiontheme
Themetypetheme
ThemeOptionstypetheme
TitleBarOverlaytypetheme
createWindowsfunctionwindows
AttachOptionstypewindows
QuitRequesttypewindows
WindowOrigintypewindows
WindowPointtypewindows
Windowstypewindows
WindowsOptionstypewindows

@adecore/shell/bridge ​

The shapes that cross IPC. Imports nothing from Electron, so a preload and the page use it too.

NameKindSource
ipcSubscriberfunctionbridge/ipc
IpcListenerstypebridge/ipc
Subscribetypebridge/ipc
MENU_ROLESconstbridge/menu
MenuBarRoletypebridge/menu
MenuNodetypebridge/menu
MenuRoletypebridge/menu
MenuSpectypebridge/menu
ThemeStatetypebridge/theme
UpdateErrorCodetypebridge/update
UpdateStatetypebridge/update
compareVersionsfunctionbridge/versions
isVersionfunctionbridge/versions

Licenses and third-party notices are listed in each package.