Private
_resourcesAll the resources of the store
Private
Optional
agentCurrent Agent, used for signing commits. Is required for posting things.
Private
clientPrivate
eventPrivate
findPrivate
injectedPrivate
randomPrivate
serverThe base URL of an Atomic Server. This is where to send commits, create new instances, search, etc.
A list of all functions that need to be called when a certain resource is updated
Private
webMapped from origin to websocket
Always fetches resource from the server then adds it to the store.
The resource URL to be fetched
Optional
opts: { body?: string | ArrayBuffer; fromProxy?: boolean; method?: "GET" | "POST"; noWebSocket?: boolean; setLoading?: boolean }Optional
body?: string | ArrayBufferHTTP Body for POSTing
Optional
fromFetch it from the /path
endpoint of your server URL. This effectively
is a proxy / cache.
Optional
method?: "GET" | "POST"HTTP Method, defaults to GET
Optional
noDo not use WebSockets, use HTTP(S)
Optional
setOverwrites the existing resource and sets it to loading.
Gets a resource by URL. Fetches and parses it if it's not available in the store. Instantly returns an empty loading resource, while the fetching is done in the background . If the subject is undefined, an empty non-saved resource will be returned.
Optional
subject: stringOptional
opts: FetchOptsInject a custom fetch implementation to use when fetching resources over http
Optional
init: RequestInitSets the current Agent, used for signing commits. Authenticates all open websockets, and retries previously failed fetches.
Warning: doing this stores the Private Key of the Agent in memory. This might have security implications for your application.
Registers a callback for when the a resource is updated. When you call this, you should probably also call .unsubscribe some time later.
Unregisters the callback (see subscribe()
)
Generated using TypeDoc
An in memory store that has a bunch of usefful methods for retrieving Atomic Data Resources. It is also resposible for keeping the Resources in sync with Subscribers (components that use the Resource), and for managing the current Agent (User).