Initializing Stores
Permissions
It's recommended to specify permissions on either Tome or its subclasses. The schema is:
interface Perm {
read: 'our' | 'space' | 'open'
write: 'our' | 'space' | 'open'
admin: 'our' | 'space' | 'open'
}ouris our ship only (src.bowl)spaceis any ship in the current Holium space. If Realm is not installed, this becomesour.openis anyone, including comets.
read / write / admin mean slightly different things based on the store type, so they will be described below.
Tome
TomeTome.init(api?: Urbit, app?: string, options?)
api: The optional Urbit connection to be used for requests. If not set, TomeDB will attempt to use localStorage for storing key-value pairs.app: An optional app name to store under. Defaults to'all'. It's recommended to set this to the name of your application (be wary of collisions, though!)
Returns: Promise<Tome>
All storage types must be created from a Tome instance, so do this first.
Key-value
Key-valuedb.keyvalue(options?)
Returns: Promise<KeyValueStore>
Initialize or connect to a key-value store. It uses localStorage if the corresponding Tome has no Urbit connection.
Feed + Log
Feed + Logdb.feed(options?) or db.log(options?)
Returns: Promise<FeedStore> or Promise<LogStore>
Initialize a feed or log store. These must be created from a Tome with a valid Urbit connection.
Last updated