Use Node.js in your end devices(QQ: 796448809)
Basically, our basic APIs are based on node.js. They will follow same form with node.js because of compatibility.
However, extended APIs need a guideline because they are implemented by many contributor. (for consistent usability)
Sync as a suffix.readSync(), writeSync(), and so on.open() API for consistent usability.open() API should have configurable as first argument and callback function as second argument.For example, GPIO module generate an object like below:
var Gpio = require('gpio');
var gpio = new Gpio();
var gpio10 = gpio.open({pin: 10, direction: gpio.DIRECTION.OUT},
                       function(err){console.log(err);});
gpio10.writeSync(1);
error can be generated in both JS/native side.error shoud be created in the place where it occurs.For example, error can be generated like below:
In native side,
iotjs_jargs_t jargs = iotjs_jargs_create(2);
// kGpioErrRead: int
if (result == kGpioErrRead) {
  iotjs_jargs_append_error_with_code(&jargs, "GPIO Error", kGpioErrRead);
}
In JavaScript side,
if (!util.isNumber(value)) {
  throw new TypeError('Bad arguments');
}
error when type checking is failed.close() api when process module occur exit event.libtuv (File open, read, write, etc.)