1.4.4 • Published 8 months ago

shared-state-trinn v1.4.4

Weekly downloads
-
License
ISC
Repository
-
Last release
8 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

8 months ago

1.4.3

8 months ago

1.4.2

8 months ago

1.4.1

8 months ago

1.4.0

9 months ago

1.3.0

9 months ago

1.2.0

9 months ago

1.1.9

10 months ago

1.1.8

10 months ago

1.1.7

10 months ago

1.1.6

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago