using bind to pass object methods as callbacks
This commit is contained in:
parent
7583cb0103
commit
788f9ecedc
|
@ -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();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue