ezlite.js

1.0.2 • Public • Published

ezlite.js

A lightweight JavaScript library for ezlite

Install

npm install ezlite.js --save

Usage

var ezlite = require('ezlite.js');

// Init WebSocket client
var client = new ezlite.Client('wss://peer.ezira.io:8090');

// Get accounts
client.call('get_accounts', ['fabien'], function(err, result) {
  console.log(err, result);
});

Promises

You can also use ezlite.js with promises by promisifying ezlite with bluebird as in:

var ezlite = require('ezlite.js');
bluebird.promisifyAll(ezlite.Client.prototype);

It'll add a Async to all ezlite functions (e.g. return client.callAsync().then())

// So instead of writing client.request('get_accounts', ['fabien'], cb); you have to write:
return client.callAsync('get_accounts', ['fabien']).then(function(result) {
  console.log(result); // => [{ id: 26921, name: 'fabien' ...]
});

License

MIT.

/ezlite.js/

    Package Sidebar

    Install

    npm i ezlite.js

    Weekly Downloads

    11

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    11.3 kB

    Total Files

    6

    Last publish

    Collaborators

    • lopu