hexo/node_modules/sdk-base
jkjoy 9a9cb42f53 20231003 update 2023-10-03 11:14:36 +08:00
..
History.md 20231003 update 2023-10-03 11:14:36 +08:00
README.md 20231003 update 2023-10-03 11:14:36 +08:00
index.js 20231003 update 2023-10-03 11:14:36 +08:00
package.json 20231003 update 2023-10-03 11:14:36 +08:00

README.md

sdk-base

NPM version build status Test coverage Gittip David deps npm download

A base class for sdk with default error handler.

Installation

$ npm install sdk-base

Usage

var Base = require('sdk-base');
var util = require('util');

function Client() {
  Base.call(this);
}

util.inherits(Client, Base);

API

  • .ready(flagOrFunction)

    // init ready
    client.ready(true);
    // listen client ready
    client.ready(function() {
      console.log('client is ready');
    });
    
  • .on(event, listener)

    // listen error event
    client.on('error', function(err) {
      console.error(err.stack);
    });
    

License

MIT