VibHub-Browser: Difference between revisions

From VibHub Wiki
Jump to navigation Jump to search
Jasx (talk | contribs)
Created page with "The library can be clone from [https://github.com/JasXSL/VibHub-Browser here]."
 
Jasx (talk | contribs)
No edit summary
Line 1: Line 1:
The library can be clone from [https://github.com/JasXSL/VibHub-Browser here].
The library can be cloned from [https://github.com/JasXSL/VibHub-Browser here].
 
=== Setup ===
Start by importing the library:
 
<code>import {default as VH, VhProgram as Program, VhStage as Stage} from 'vh-socket.js';</code>
 
Next you'll want to extend VH with a class of your own.
 
<code>class App extends VH{</code>
 
Constructor:<pre>
constructor(...args){
super(...args);
}
</pre>All done for our VibHub manager class! Let's try sending a program!<pre>
(async () => {
const manager = new App();
manager.onDeviceOnline = function(device){
device.set(255); // Sets all ports on the device to max intensity (or 1/4 if you enable high res)
};
await manager.addDevice("<your device ID>");
})();
</pre>

Revision as of 11:39, 29 January 2026

The library can be cloned from here.

Setup

Start by importing the library:

import {default as VH, VhProgram as Program, VhStage as Stage} from 'vh-socket.js';

Next you'll want to extend VH with a class of your own.

class App extends VH{

Constructor:

constructor(...args){
	super(...args);
}

All done for our VibHub manager class! Let's try sending a program!

(async () => { const manager = new App(); manager.onDeviceOnline = function(device){ device.set(255); // Sets all ports on the device to max intensity (or 1/4 if you enable high res) }; await manager.addDevice("<your device ID>"); })();