Activity Manager for any kind of statuses based on ids
npm install activity --save-dev
var Activity = require('activity');
var activity = new Activity({
statuses: ["online", "offline", "away"]
});
activity.setStatus('uid1', 'online', function(err){
if (err) {
// something went wrong
}
});
// you can set an status without checking if it was applied
activity.setStatus('uid2', 'away');
activity.setStatus('uid3', 'online');
activity.getStatus(['uid1', 'uid2'], function(err, statuses){
if (err) {
// something went wrong
}
else {
console.dir(statuses); // { uid1: 'online', uid2: 'away' }
}
});
activity.getStatus('uid1', function(err, status){
if (err) {
// something went wrong
}
else {
console.dir(status); // 'online'
}
});
activity.getIds('online', function(err, ids){
if (err) {
// something went wrong
}
else {
console.dir(ids); // [ 'uid1', 'uid3' ]
}
});
- Add option to use Redis to store the current statuses.
- A way to clear all ids.
- Fork this repo
- run
npm install
- Create the tests for the new functionality or bug case
- Put your awesome code
- run
grunt test
- All good?, place a pull request