Fired when a new item appears in the map, regardless of whether its creator was local or remote.
Parameters:
args
- info object provided with the event. It has the following properties:item
- added itemisLocal
- equals true if the item was added by a local actor, false otherwiseFired when a map item is removed, regardless of whether the remover was local or remote.
Parameters:
args
- info object provided with the event. It has the following properties:key
- the key of the removed itemisLocal
- equals true if the item was added by a local actor, false otherwisepreviousItemData
- contains a snapshot of the item data before removalFired when a map item is updated (not added or removed, but changed), regardless of whether the updater was local or remote.
Parameters:
args
- info object provided with the event. It has the following properties:item
- updated itemisLocal
- equals true if the item was updated by a local actor, false otherwisepreviousItemData
- contains a snapshot of the item data before the updateFired when a map is deleted entirely, by any actor local or remote.
Parameters:
args
- info object provided with the event. It has the following properties:isLocal
- equals true if the map was removed by a local actor, false otherwiseDate when the map was last updated.
An immutable identifier (a SID) assigned by the system on creation.
An optional immutable identifier that may be assigned by the programmer to this map on creation. Unique among other Maps.
Conclude work with the map instance and remove all event listeners attached to it. Any subsequent operation on this object will be rejected with error. Other local copies of this map will continue operating and receiving events normally.
Retrieve an item by key.
Identifies the desired item.
A promise that resolves when the item has been fetched. This promise will be rejected if item was not found.
Get a complete list of items from the map. Information about the query limits can be found here.
Query options.
Schedules a modification to this Map SyncMapItem that will apply a mutation function.
If no SyncMapItem with the given key exists, it will first be created, having the default data ({}
).
Selects the map item to be mutated.
A function that outputs a new data based on the existing data. May be called multiple times, particularly if this Map SyncMapItem is modified concurrently by remote code. If the mutation ultimately succeeds, the Map SyncMapItem will have made the particular transition described by this function.
New item metadata.
Resolves with the most recent item state, the output of a successful
mutation or a state that prompted graceful cancellation (mutator returned null
).
Delete an item, given its key.
Selects the item to delete.
A promise to remove an item. The promise will be rejected if 'key' is undefined or an item was not found.
Delete this map. It will be impossible to restore it.
A promise that resolves when the map has been deleted.
Add a new item to the map with the given key-value pair. Overwrites any data that might already exist with that key.
Unique item identifier.
Data to be set.
New item metadata.
Newly added item, or modified one if already exists, with the latest known data.
Update the time-to-live of a map item.
SyncMapItem key.
Specifies the TTL in seconds after which the map item is subject to automatic deletion. The value 0 means infinity.
A promise that resolves after the TTL update was successful.
Update the time-to-live of the map.
Specifies the TTL in seconds after which the map is subject to automatic deletion. The value 0 means infinity.
A promise that resolves after the TTL update was successful.
Modify a map item by appending new fields (or by overwriting existing ones) with the values from the provided Object. Creates a new item if no item by this key exists, copying all given fields and values into it. This is equivalent to
map.mutate('myKey', (currentData) => Object.assign(currentData, obj));
Selects the map item to update.
Specifies the particular (top-level) attributes that will receive new values.
New item metadata.
A promise resolving to the modified item in its new state.
Represents a Sync map, which is a data structure that stores an unordered set of key-value pairs. Use the SyncClient.map method to obtain a reference to a Sync map. Information about rate limits can be found here.