1.0.1 • Published 9 years ago

nachos-api v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

nachos-api

API to interact with nachos core

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