Repository navigation
Settings only main changes, settings checks, and kit.settings.onChange() - #74
Merged
Merged
Conversation
…ange()
kit.start({ settings: { mainOnly, checks } }): the page's change naming a
setting only main changes is refused whole, and nothing of it is stored;
a setting's check refuses a value from the page or from main. Both name
the app's own settings only, checked at start().
kit.settings.onChange(listener) hears every stored change as
(changes, after, { from }), after the updater and the log have acted on
it, and returns the function that stops it. A listener that throws or
rejects is logged; the change stays stored and the others still hear it.
The demo's export folder is main's alone, and a whole path when set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #66.
What's new
kit.start({ settings: { mainOnly: [...] } }): the page'skitAPI.setSettings()naming one of them is refused whole ("The setting "downloadFolder" can't be changed from the page."), and nothing of that change is stored.kit.settings.set()in main changes them as any other, and the page reads them as before.settings: { checks: { key: (value) => boolean } }: a function per setting, handed a copy of the value once its kind is checked. Unless it returnstruethe change is refused whole, from the page or from main ("The setting "transfersAtOnce" doesn't take that value."). Reads aren't checked.start(): the app's own settings only (keys ofdefaults, never the kit's), each check a function; a mistake throws withkit.start()'s name, before anything is registered.kit.settings.onChange(listener)returns the function that stops it, and hears every stored change as(changes, after, { from }),from"page"or"main"(the updater saving the build's channel the first time counts as main's). Each listener gets its own copies, and is told after the kit's own updater and log handling. A refused change tells no one. A listener that throws, or rejects, is logged as an error; the change stays stored and the other listeners still hear it.exportFolder, main's alone, with a check that it's a whole path when set.docs/main-process.md(Settings Only Main Changes, and Checks; Hearing a Change), and the docs index line.Tests
test/store.test.js+13: the refusals atstart()(and increateSettings()); the page's change naming a main-only key refused with nothing stored, main's taken and read by the page; checks refusing from the page and from main, kind checked first, a copy handed over; reads unchecked; the listener's arguments for both; a refused change heard by no one; copies per listener; the order after the updater (an update already downloading) and the memory log (debug.logalready on disk); the updater's own channel save; unsubscribe, and one function added twice; listeners added or stopped while a change is told; a throwing and a rejecting listener.e2e/log-store.spec.js+1: in the demo, the page's change ofexportFolderrefused with nothing stored, main's accepted and read by the page, a relative folder refused by the check, andonChangehearing main's and the page's changes withfrom.npm test318 of 318; the e2e suite locally 179 passed, 8 skipped (packaged only).No page change, so no visual image changes: the 86 baselines are untouched, and the local run matched all of them.