Called on any errors loading/saving/etc, should be used to notify the user.
OptionalonExport?: (res: object) => voidCalled when a manager is exported. Can be used to actually do the export.
OptionalonParse?: (parsed: object) => undefined | ErrorCalled when a manager is parsed from storage after being sucessfully JSON.parsed.
You can validate the parsed object here so it's in the correct shape to pass to createManager.
If you return an error, onError will be called and createManager will be skipped.
OptionalonSave?: (clone: DeepPartial<Manager>) => voidCalled when a manager is saved or exported. It's called with the cloned version of the manager that has been stripped of properties that should not be saved (see managerToStorableClone).
You can delete/add properties here (it will not modify the original manager).
OptionalonSetActiveManager?: (name: string) => voidCalled when the active manager is set. Can be used to update your state.
OptionalonSetManager?: (name: string, clone: Manager) => voidCalled when a manager is set. Can be used to update your state.
OptionalonSetManagerNames?: (names: string[]) => voidCalled when the manager names are set. Can be used to update your state.
ReadonlyactiveAll new managers will be created using this function. It should be capable of taking as little information as {name} (when a new manager is created) and returining a full manger.
It's suggested you not do validation here, use the onParse hook instead.
If you return an error, onError will be called, and no manager will be created.
A debounced version of the save function. Is already bound to the instance.
Called on any errors loading/saving/etc, should be used to notify the user.
OptionalonExport?: (res: object) => voidCalled when a manager is exported. Can be used to actually do the export.
OptionalonParse?: (parsed: object) => undefined | ErrorCalled when a manager is parsed from storage after being sucessfully JSON.parsed.
You can validate the parsed object here so it's in the correct shape to pass to createManager.
If you return an error, onError will be called and createManager will be skipped.
OptionalonSave?: (clone: DeepPartial<Manager>) => voidCalled when a manager is saved or exported. It's called with the cloned version of the manager that has been stripped of properties that should not be saved (see managerToStorableClone).
You can delete/add properties here (it will not modify the original manager).
OptionalonSetActiveManager?: (name: string) => voidCalled when the active manager is set. Can be used to update your state.
OptionalonSetManager?: (name: string, clone: Manager) => voidCalled when a manager is set. Can be used to update your state.
OptionalonSetManagerNames?: (names: string[]) => voidCalled when the manager names are set. Can be used to update your state.
ReadonlymanagerReadonlymanagersProtectedaddClears all managers and resets the state. init must be called again if you want to use the class instance again.
ProtectedloadProtectednotifyProtectedremoveOptionalclone: anyProtectedstorageProtectedstorageProtectedstorage
All new managers will be created using this function. It should be capable of taking as little information as
{name}(when a new manager is created) and returining a full manger.It's suggested you not do validation here, use the
onParsehook instead.If you return an error,
onErrorwill be called, and no manager will be created.