1.4.4 • Published 12 months ago

shared-state-trinn v1.4.4

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

Shared state TRINN

this package allows for easy sharing of states between applications over WebRTC build on TRINN-remote-control

Installation

The package can be installed using npm:

npm i trinn-remote-control

Example

for the remote

await StateManager.setOnConnection((event, id) => {
  console.log("connection: ", event, id);
})
  .setId("someSharedId")
  .setRemote()
  .init("your api key");

init("your api key", "someSharedId", true);
const state = await StateManager.addState("someStateId", { value: 0 });
state.subscribe((value) => {
  console.log(value);
});

for the controller

await StateManager.setOnConnection((event, id) => {
  console.log("connection: ", event, id);
})
  .setId("someSharedId")
  .init("your api key");
const state = await StateManager.awaitState("someStateId");
state.set({ value: 1 });

this will initialise the state with the value 0 in the remote and then set the value to 1 in the controller

1.4.4

12 months ago

1.4.3

12 months ago

1.4.2

12 months ago

1.4.1

12 months ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago