API
allKeysIn
Enumerates keys of all Svelte Eagle Eye instances created using a given
requestToken object.is a function accepting an optional
requestToken argument.Note: If none is provided; will enumerate those of the application when in browser environment.
createEagleEye
Provisions a Svelte Eagle Eye instance to the application in ways that negotiates the runtime environment.
is a function accepting a payload consisting of five properties. To wit:
- key: a mandatory context key information. (This key is whatever name you'd like to give this instance.)
- prehooks: the optional prehooks
- storage: the optional storage
- requestToken: an object holding a unique
_idassociated with a server request. Both this object and its reference identify the request. This object is mandatory for every server-side requests but unneccessary in the browser environment. (The unique_idis whatever string value you'd like to assign the request.) - value: the optional initial state object or AutoImmutable instance bearing this initial state object
and returning an object holding Svelte Eagle Eye instance and its identifying information.
Note: Calling this function with a payload matching an existing Svelte Eagle Eye instance will produce an object holding existing instance and its identifying information.
The returned instance is the store-bearing context.
The context's store is directly accessible through its
store property.discardEagleEye
Disposes and removes a Svelte Eagle Eye instance from the application.
is a function accepting a payload consisting of two properties. To wit:
- key: assigned to this Svelte Eagle Eye at creation.
- requestToken: assigned to this Svelte Eagle Eye instance at creation.
Note: Once removed, its key cannot be reused. It will always return null.
useEagleEye
Produces an existing Svelte Eagle Eye instance matching the supplied payload.
is a function accepting a payload consisting of two properties. To wit:
- key: assigned to this Svelte Eagle Eye at creation.
- requestToken: assigned to this Svelte Eagle Eye instance at creation.
Svelte Eagle Eye Instance
Once, the Svelte Eagle Eye instance has been obtained, it can be utilized in the following ways:
cache
is a property of the Svelte Eagle Eye instance providing access to the underlying immutable cache that it manages.
closed
is a boolean property of the Svelte Eagle Eye instance confirming that the instance is still active.
Use the "closing" event to be notified right before context deactivation.
Please see the dispose method below.
dispose
is a method of the Svelte Eagle Eye instance for deactivating this context.
Context deactivation is permanent.
The context's
closed property confirms this status.stream
is a function property of the Svelte Eagle Eye instance intentionally made as a no-frills means for observing and communicating with this instance.
It accepts:
- ownerDesc: a mandatory name to identifying the streaming component. (This value is whatever name you'd like to assign this component.)
- selectorMap: an optional selector map parameter.
and returns a change stream context store.
The injected store monitors changes in the underlying state slices referenced by the selector map.
A change in any of the referenced state slices automatically triggers an update of the related
store.data property and a subsequent render of the client.