SparkJS is a library for interacting with your cores and the Spark Cloud. It uses node.js and can run on Windows, Mac OS X, and Linux fairly easily. It can also run in the browser without node.js. It's also open source so you can edit, change or even send in pull requests if you want to share!
Complete documentation can be found in Spark Docs
First, make sure you have node.js installed!
Next, open a command prompt or terminal, and install by typing:
$ npm install -g spark
var Spark = require('spark');
Spark.login({ username: '[email protected]', password: 'password' }, function(err, body) {
console.log('API call login completed on callback:', body);
});
For further examples visit /examples directory: https://github.com/spark/sparkjs/tree/master/examples
Complete documentation can be found in Spark Docs
It's important that you login before executing any command.
Every function returns a promise for you to handle the async result, or you can pass a callback function. (Please note that if a callback function is passed, the function will return null instead of a promise)
More examples on how to use promises/callbacks visit: https://github.com/spark/sparkjs/tree/master/examples
- compileCode
- createUser
- callFunction
- claimCore
- downloadBinary
- flashCore
- getAttributes
- getAttributesForAll
- getEventStream
- getVariable
- listDevices
- login
- onEvent
- publishEvent
- removeCore
- removeToken
- renameCore
- signalCore
You can get a list of devices by calling: Spark.devices
Each device has the following parameters:
- name
- connected
- variables
- functions
- version
- requiresUpgrade
And you can call the following commands on it:
- callFunction
- claim
- flash
- subscribe
- getVariable
- onEvent
- remove
- rename
- sendPublicKey
- signal
- stopSignal
- getAttributes
Complete documentation can be found in Spark Docs
Install your local dependencies:
$ npm install
Install globally mocha, istanbul uglify-js and jshint
$ npm install -g mocha
$ npm install -g istanbul
$ npm install -g uglify-js
$ npm install -g jshint
make test
make lint
make cover
Version 0.1.0 Initial release Version 0.2.1 Publishing, test release