@fluid-experimental/attributable-map
TypeScript icon, indicating that this package has built-in type declarations

2.0.0-dev.4.1.0.148229 • Public • Published

@fluid-experimental/attributable-map

Overview

This experimental DDS is a copy of SharedMap which additionally tracks attribution information, such as the user who made an update and the timestamp of the change. Please refer to the description of attributor for more details.

SharedMap

The SharedMap distributed data structure can be used to store key-value pairs. It provides the same API for setting and retrieving values that JavaScript developers are accustomed to with the Map built-in object.

Creation

To create a SharedMap, call the static create method:

const myMap = SharedMap.create(this.runtime, id);

Usage

Unlike the JavaScript Map, a SharedMap's keys must be strings. The value must only be plain JS objects or handles (e.g. to another DDS or Fluid objects).

In collaborative scenarios, the value is settled with a policy of last write wins.

.wait()

SharedMap has a wait method in addition to the normal get, which returns a Promise that resolves to the value when the key becomes available.

Eventing

SharedMap is an EventEmitter, and will emit events when other clients make modifications. You should register for these events and respond appropriately as the data is modified. valueChanged will be emitted in response to a set or delete, and provide the key and previous value that was stored at that key. clear will be emitted in response to a clear.

Readme

Keywords

none

Package Sidebar

Install

npm i @fluid-experimental/attributable-map

Weekly Downloads

447

Version

2.0.0-dev.4.1.0.148229

License

MIT

Unpacked Size

409 kB

Total Files

72

Last publish

Collaborators

  • ms-fluid-bot
  • curtisman