1.13.0 • Published 26 days ago
trinn-remote-control v1.13.0
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.13.0
26 days ago
1.12.0
26 days ago
1.11.1
26 days ago
1.11.0
26 days ago
1.9.1
28 days ago
1.9.0
28 days ago
1.8.1
28 days ago
1.9.3
28 days ago
1.9.2
28 days ago
1.10.1
28 days ago
1.8.0
2 months ago
1.7.2
2 months ago
1.7.1
2 months ago
1.7.0
2 months ago
1.6.2
3 months ago
1.6.1
3 months ago
1.6.0
3 months ago
1.5.0
3 months ago
1.4.1
3 months ago
1.3.2
3 months ago
1.4.0
3 months ago
1.3.1
3 months ago
1.2.2
3 months ago
1.3.0
3 months ago
1.2.1
3 months ago
1.2.0
3 months ago
1.1.1
3 months ago
1.0.2
3 months ago
1.1.0
3 months ago
1.0.1
3 months ago
1.0.0
6 months ago