1 module.exports = ProxyHandler;
3 function ProxyHandler(cbs) {
7 var EVENTS = require("./").EVENTS;
8 Object.keys(EVENTS).forEach(function(name) {
9 if (EVENTS[name] === 0) {
11 ProxyHandler.prototype[name] = function() {
12 if (this._cbs[name]) this._cbs[name]();
14 } else if (EVENTS[name] === 1) {
16 ProxyHandler.prototype[name] = function(a) {
17 if (this._cbs[name]) this._cbs[name](a);
19 } else if (EVENTS[name] === 2) {
21 ProxyHandler.prototype[name] = function(a, b) {
22 if (this._cbs[name]) this._cbs[name](a, b);
25 throw Error("wrong number of arguments");