Ethan-Arrowood / harperdb-nodejs-driver

Node.JS Database Driver for HarperDB
MIT License
5 stars 2 forks source link

[FEATURE] Event Channels #11

Closed dechristopher closed 7 years ago

dechristopher commented 7 years ago

Implemented event emission accessible through the HarperDB class as this.event. Additionally cleaned up a few places in the repo like the package.json and README.md to bring them up to par with standards.

Example:

...

const db = new HarperDB();

db.connect(
  "http://localhost:9925",
  process.env.HARPERDB_USERNAME,
  process.env.HARPERDB_PASSWORD
);

db.event.on('request', function() {
  console.log('A request was just made.');
});

db.request({ operation: 'list_users'})
  .then(response => {
    console.log(response);
  })
  .catch(e => console.error(e));

...

This will log the following:

{ The request response }
A request was just made.
dechristopher commented 7 years ago

Implements #5