using bind to pass object methods as callbacks

This commit is contained in:
Manuel Araoz 2014-01-13 15:43:40 -03:00
parent 7583cb0103
commit 788f9ecedc
1 changed files with 4 additions and 4 deletions

View File

@ -106,11 +106,11 @@ function spec() {
});
peerman.on('connection', function(conn) {
conn.on('inv', function(x){self.handle_inv(x);});
conn.on('block', function(x){self.handle_block(x);});
conn.on('tx', function(x){self.handle_tx(x);});
conn.on('inv', self.handle_inv.bind(self));
conn.on('block', self.handle_block.bind(self));
conn.on('tx', self.handle_tx.bind(self));
});
peerman.on('connect', function(x){self.handle_connected(x);});
peerman.on('connect', self.handle_connected.bind(self));
peerman.start();
};