Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
smartbase is a base board for you to create a smartobject with plugins.
This module helps developers integrate plugins into a smartobject. smartbase is like a carrier and plugins are various peripherals such as a LED, a temperature sensor, a switch to be put into the smartobject. In addition, **smartbase ** makes the smartobject listenable as well.
$ npm install smartbase --save
var SmartObject = require('smartobject'),
smartbase = require('smartbase');
// Plugin of a LED on LinkIt Smart 7688
var ledPlugin = require('linkit-smart-7688-led');
var so = new SmartObject();
so = smartbase(so, {
led0: ledPlugin({ iid: 0, pin: 10, active: 'high' }),
led1: ledPlugin({ iid: 1, pin: 11, active: 'low' })
});
// attach a listener to receive the change from resource 'lightCtrl/0/onOff'
so.onChange('lightCtrl/0/onOff', function (cVal, pVal) {
console.log('A listener to this resource');
console.log(cVal); // current value
console.log(pVal); // previous value
});
so.onChange('temperature/0/sensorValue', function (cVal, pVal) {
console.log('Another listener to this resource');
});
// Modify the sensorValue of the temperature sensor and the listener will be triggered
so.write('temperature', 0, 'sensorValue', 80, function (err, data) {
if (err)
console.log(err);
});
FAQs
Create a smartobject by using plugins.
The npm package smartbase receives a total of 0 weekly downloads. As such, smartbase popularity was classified as not popular.
We found that smartbase demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.