~stephen-stewart/+junk/add-grunt

« back to all changes in this revision

Viewing changes to node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/htmlparser2/lib/ProxyHandler.js

  • Committer: Stephen Stewart
  • Date: 2014-05-13 01:26:55 UTC
  • Revision ID: stephen.stewart@canonical.com-20140513012655-wx8xbwcdohofxoyj
add --production node_modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
module.exports = ProxyHandler;
 
2
 
 
3
var ProxyHandler = function(cbs){
 
4
        this._cbs = cbs || {};
 
5
};
 
6
 
 
7
var EVENTS = require("./").EVENTS;
 
8
Object.keys(EVENTS).forEach(function(name){
 
9
        if(EVENTS[name] === 0){
 
10
                name = "on" + name;
 
11
                ProxyHandler.prototype[name] = function(){
 
12
                        if(this._cbs[name]) this._cbs[name]();
 
13
                };
 
14
        } else if(EVENTS[name] === 1){
 
15
                name = "on" + name;
 
16
                ProxyHandler.prototype[name] = function(a){
 
17
                        if(this._cbs[name]) this._cbs[name](a);
 
18
                };
 
19
        } else if(EVENTS[name] === 2){
 
20
                name = "on" + name;
 
21
                ProxyHandler.prototype[name] = function(a, b){
 
22
                        if(this._cbs[name]) this._cbs[name](a, b);
 
23
                };
 
24
        } else {
 
25
                throw Error("wrong number of arguments");
 
26
        }
 
27
});
 
 
b'\\ No newline at end of file'