RazerChroma JS
Pure JavaScript bindings to Razer Chroma devices using the Razer's RESTful API
This library provides a simple wrapper for the Razer RESTful API to let you get up and running with it as quickly as possible. In order to use it, you can require the Chroma class using:
Installation
npm i razerchroma -s
Simple 👍
Usage
A simple example is included at example/example.js
. This should start an instance, light up your keyboard in a 🌈 rad rainbow 🌈 and then cleanup after 5 seconds.
Importing the library
var Chroma = ;
Initializing a new instance
The application
object defines the application, it should follow the schema described in the official documentation
let chroma;Chroma
Setting state
set({device,method='PUT',body})
By default, the set method will send using a PUT command, if you would like to POST and use the response the method will return a promise from the request
The device must be a device on the list from the application configuration.
The body should match the JSON schema described here, generally following the shape {effect,param}
// Defaults to a PUT callchroma // We can do a POST call and get an effect idchroma
Cleanup
Although the connection will timeout by default after 15 seconds, we should clean up whenever we are done with the Chroma connection (when our app closes).
chroma
Easy.