new LoggerConfigSaver( key )

Description

Automatically load/save Logger configs based on state changes.

This particular implementation is intended to be efficient but imperfect. Data, at least as far as high water marks, may be lost.

It monitors changes to Logger configs, and saves them to userscript storage as appropriate.

If the userscript enables the value change listener API (see below), that will be used to detect when values need to be reread. Otherwise, it will use the browser based visibilitychange event to reload.

// Enable in the ==UserScript== header with:
			// @grant GM.addValueChangeListener
			// @grant GM.removeValueChangeListener
			
Parameters
Name Type Description
key string

Userscript storage key.

Methods


Symbol.dispose()

Description

Dispose of the instance.

Details

<async> handleEvent()

Description

Event listener callback.

Details

<private> load()

Details

<private> save( reason )

Parameters
Name Type Description
reason string

Attached to mutex as a debugging aid.

Details

<private> valueChangeListener( key, oldValue, newValue, remote )

Parameters
Name Type Description
key string

The name of the observed variable.

oldValue object

The old value of the observed variable.

newValue object

The new value of the observed variable.

remote boolean

Same script or different tab.

Details

<private> onLoggerConfig( evt, record )

Parameters
Name Type Description
evt string

Type of mutation.

record NexusHoratio.base.Logger~ConfigMutationRecord

Details about the mutation.