Code coverage report for socket.io-client/lib/on.js

Statements: 100% (5 / 5)      Branches: 100% (0 / 0)      Functions: 100% (2 / 2)      Lines: 100% (5 / 5)      Ignored: none     

All files » socket.io-client/lib/ » on.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25          1                     1 50 50   33        
 
/**
 * Module exports.
 */
 
module.exports = on;
 
/**
 * Helper for subscriptions.
 *
 * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
 * @param {String} event name
 * @param {Function} callback
 * @api public
 */
 
function on(obj, ev, fn) {
  obj.on(ev, fn);
  return {
    destroy: function(){
      obj.removeListener(ev, fn);
    }
  };
}