both.io
both
Last updated 5 years ago by michaelzoidl .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install both.io 
SYNC missed versions from official npm registry.

BothIO Logo

Gratipay Build Status bitHound Score Codacy Badge devDependency Status

What is BothIO?

Simply, it's a library based on the CQS-Princip, where your methods are separated by commands and queries.

What BothIO makes so special is the NodeJS/Client-Support, so you can execute your commands and queries from your node-side as well as from your client-side.

Example


var myToDoList = [];

// # Define a Command
// Server:
both.command('CreateTodo', function(name, payload, callback){
  myToDoList.push(payload.todoName);
});

// Execute a Command
// Client:
both('CreateTodo', {
  todoName: 'eat some chocolate'
});


// Listen to a defined Command
// Server:
both.on('CreateTodo', function(name, payload){
  console.log('Todo Created:', payload.todoName);
});

// Listen to all Commands
// Client:
both.on(function(commandName, payload){
  console.log('The command', commandName, 'was executed!');
  console.log('with the payload:', payload);
});


// # Add a Callback
// Server:
both.query('GetAllTodos', function(name, payload, callback){
  someDatabase.query('getAllTodos', function(todos){
    callback(todos);
  });
});

// Client:
both('GetAllTodos', {}, function(todos){
  // Use Todos at the client
})

And there's something more planed

Battle-Tested

This project is used at the entertain.io platform.

Contribute

BothIO uses the new ES6 standard and is tested with mocha, plus we package the code with webpack.

You want contribute? Here is how you start:
Clone repo
git clone git@github.com:michaelzoidl/both.io.git
Run the unit-tests
npm run test
Pack the code and save it in the dist-folder
npm run pack
Develop, it starts a mocha-watcher
npm run develop

Current Tags

  • 0.9.1                                ...           latest (5 years ago)

17 Versions

  • 0.9.1                                ...           5 years ago
  • 0.9.0                                ...           5 years ago
  • 0.8.94                                ...           5 years ago
  • 0.8.93                                ...           5 years ago
  • 0.8.92                                ...           5 years ago
  • 0.8.91                                ...           5 years ago
  • 0.8.9                                ...           5 years ago
  • 0.8.8                                ...           5 years ago
  • 0.8.7                                ...           5 years ago
  • 0.8.6                                ...           5 years ago
  • 0.8.5                                ...           5 years ago
  • 0.8.4                                ...           5 years ago
  • 0.8.3                                ...           5 years ago
  • 0.8.2                                ...           5 years ago
  • 0.8.1                                ...           5 years ago
  • 0.8.0                                ...           5 years ago
  • 0.7.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 8
Dependencies (8)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |