npm.io
1.0.1 • Published 11 years ago

nachos-api

Licence
MIT
Version
1.0.1
Deps
7
Vulns
6
Weekly
0

nachos-api

API to interact with nachos core

Linux OSX Windows Coverage Dependencies DevDependencies
Coverage Status

Have a problem? Come chat with us!

Join the chat at https://gitter.im/nachos/nachos-api

Installation

$ [sudo] npm install nachos-api --save

Usage

Initialization
var nachosApi = require('nachos-api');
Custom events
on(packageName, callback)

Register custom events

nachosApi.on('your-package', function () {
  // Code to execute on event custom.your-package
});
emit(packageName, data)

Emit custom event

nachosApi.emit('your-package', { ... }); // -> emits custom.your-package with the sent data
removeListener(packageName, callback)

Remove event listener

nachosApi.removeListener('your-package', cb);  // cb -> The callback used on registration
Settings
Example
nachosApi.settings('your-package')
  .save({ ... })
  .then(function () {
    // Saved data successfully
  });

See settings-file documentation to see list of available functions

Server
Examples
nachosApi.server.users.me()
  .then(function (user) {
    // user -> your user data
  });

See server-api documentation to see list of available functions

System
open(data)
nachosApi.system.open('path/to/file')
  .then(function () {
    // Opened successfully
  });

Run Tests

$ npm test

License

MIT

Keywords