STB Devtools is a suite of tools built on top of websockets to a backend from a JS environment
npm install stb-devtoolsTools written in plain Javascript to setup some tools to help work on devices without Webdriver support.
Due to usage of WeakSet for circular JSON detection the browser support is defined fully here: https://caniuse.com/?search=Weakset
Native Browser Support:
- Chrome 36
- Firefox 34
- Safari 9
Put a tag into your application's HTML that loads client/index.js. This will put the following APIs into the global scope.
- createSocket('ws://localhost:3031') Creates a websocket connection to the remote server provided, other features work over this network connection.
- closeSocket() Closes the websocket connection on the client.
API:
- injectConsole() Replaces the console API with sending logs to the socket server.
- restoreConsole() Restores the console API back to it's original methods.
API:
- remoteControlOn() Starts broadcasting keyboard events from this browser to all other connected clients, who will dispatch the events as synthetic keyboard events locally automatically.
#### Client usage
From the client send a command like the below
```
stbSocket.send(JSON.stringify({command: 'temp-file', data: data }));
#### Socket Payload:
``
{
command: 'temp-file',
data: 'stringetc'
}
Will be saved to a temporary file using the module tempy`.