Skip to content

pjnovas/activity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##Activity Build Status Coverage Status NPM version

Activity Manager for any kind of statuses based on ids

Getting Started

npm install activity --save-dev

Create an activity

var Activity = require('activity');

var activity = new Activity({
  statuses: ["online", "offline", "away"]
});

Set an status

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');

Get statuses

activity.getStatus(['uid1', 'uid2'], function(err, statuses){
  if (err) {
    // something went wrong
  }
  else {
    console.dir(statuses); // { uid1: 'online', uid2: 'away' }
  }
});

Get one status

activity.getStatus('uid1', function(err, status){
  if (err) {
    // something went wrong
  }
  else {
    console.dir(status); // 'online'
  }
});

Get ids by an status

activity.getIds('online', function(err, ids){
  if (err) {
    // something went wrong
  }
  else {
    console.dir(ids); // [ 'uid1', 'uid3' ]
  }
});

TODO

  • Add option to use Redis to store the current statuses.
  • A way to clear all ids.

Contribute

  1. Fork this repo
  2. run npm install
  3. Create the tests for the new functionality or bug case
  4. Put your awesome code
  5. run grunt test
  6. All good?, place a pull request

About

Activity Manager for any kind of statuses based on ids

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published