Socket
Socket
Sign inDemoInstall

@fluid-experimental/attributable-map

Package Overview
Dependencies
53
Maintainers
2
Versions
139
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @fluid-experimental/attributable-map

Distributed map


Version published
Weekly downloads
359
increased by17.7%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

@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.

FAQs

Last updated on 06 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc