1.17.0 • Published 9 months ago

trinn-remote-control v1.17.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

TRINN Remote Control

This package allows for simple remote control of applications over WebRTC.

Installation

The package can be installed using npm:

npm i trinn-remote-control

Example Usage

After the package has been installed you now have access to two classes: TRINNController and TRINNRemote.

//remote.js

const remote = new TRINNRemote("SomeSharedId");

remote.onPress((key) => {
  console.log(`${key} was pressed`);
});

remote.onRelease((key) => {
  console.log(`${key} was released`);
});

remote.onData((object) => {
  console.log(object);
});

remote.sendData({ type: "bicycle", amount: 5 });
//controller.js

const controller = new TRINNController("SomeSharedId");

document.addEventListener("keydown", (e) => {
  controller.sendPress(e.key);
});

document.addEventListener("keyup", (e) => {
  controller.sendRelease(e.key);
});

controller.sendData({ type: "bicycle", amount: 5 });

controller.onData((object) => {
  console.log(object);
});

Known Issues

Because this library depends on PeerJS we are unfortunately not able to support SSR at this time

Todo

  • Add configurable PeerJS server
1.15.0

10 months ago

1.17.0

9 months ago

1.16.1

9 months ago

1.16.0

9 months ago

1.14.1

12 months ago

1.14.0

1 year ago

1.13.0

1 year ago

1.12.0

1 year ago

1.11.1

1 year ago

1.11.0

1 year ago

1.9.1

1 year ago

1.9.0

1 year ago

1.8.1

1 year ago

1.9.3

1 year ago

1.9.2

1 year ago

1.10.1

1 year ago

1.8.0

1 year ago

1.7.2

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.2

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

1.5.0

1 year ago

1.4.1

1 year ago

1.3.2

1 year ago

1.4.0

1 year ago

1.3.1

1 year ago

1.2.2

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.0.2

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

2 years ago