Repository navigation
0.1.0-beta.3
Pre-release
Pre-release
@diamonddigitaldev/electron-kit | Beta Preview (v0.1.0-beta.3)
Important
A beta: the API can still change between 0.x versions. It's published under npm's next tag.
What an app needs to keep nothing it wasn't asked to, and to run a window without the kit's bridge. Everything here is new and changes nothing an app already uses: an app on 0.1.0-beta.2 takes it without a change.
npm install @diamonddigitaldev/electron-kit@nextNew
- The memory log.
start({ log: "memory" })keeps the run's last lines in memory (1000, or{ mode: "memory", lines }), redacted as the file log is, and writes nothing to disk. It adds a setting,keepLogOnDisk, off by default, for a switch the app shows itself: turned on, the run so far is written todebug.logand each line after it added; turned off, or off at launch,debug.logis deleted.kit.log.lines()gives the last lines in every mode, so an app can copy or save them. - Isolated sessions.
kit.sessions.isolated(name)gives a session without the kit's bridge, for a window that handles data from the network or shows a page that isn't the app's: a partition of its own, in memory unless{ persist: true }, with no spell-check dictionaries, and every permission refused.kit.ipc.handle(channel, handler, { session })answers the app's own page in that session only, and refuses the main window's. - An allowlist for links.
start({ openExternal: { allow: [...] } })narrowsshell:open-externalto the sites listed, matched as URLs (the same scheme, host and port, and a path inside the entry's), never as text, sohttps://diamonddigital.devdoesn't lethttps://diamonddigital.dev.example.comthrough. The links the kit shows from the app's own config (the Credits tab's, and the repository's releases) are always allowed. - The outside-lookup check, for an app's own tests.
netLogSwitches(),outsideLookups(),proxyLookups()andassertNoOutsideLookups()inelectron-kit/testingread Chromium's net log once the app has quit, and fail on any name looked up beyond the machine, or any search for a proxy. The kit's own tests check every launch of its demo this way, on Windows and Linux.
Docs
- New pages: Testing an App, and sections on the memory log and isolated sessions in The Main Process, and on the allowlist in IPC.
- How spell checking is kept from downloading dictionaries, on every session.
The docs are in the repository: start at docs/README.md.
Found something wrong? Open an issue.