Change to use bitcoind/addresstxid event
This commit is contained in:
parent
923c596b74
commit
3532cd25a1
|
@ -8,12 +8,12 @@ angular.module('insight.address').controller('AddressController',
|
|||
var socket = getSocket($scope);
|
||||
|
||||
var _startSocket = function () {
|
||||
socket.emit('subscribe', $routeParams.addrStr);
|
||||
socket.on($routeParams.addrStr, function(tx) {
|
||||
socket.on('bitcoind/addresstxid', function(tx) {
|
||||
$rootScope.$broadcast('tx', tx);
|
||||
var beep = new Audio('/sound/transaction.mp3');
|
||||
beep.play();
|
||||
});
|
||||
socket.emit('subscribe', 'bitcoind/addresstxid', [$routeParams.addrStr]);
|
||||
};
|
||||
|
||||
socket.on('connect', function() {
|
||||
|
|
|
@ -39,8 +39,9 @@ ScopedSocket.prototype.on = function(event, callback) {
|
|||
ScopedSocket.prototype.emit = function(event, data, callback) {
|
||||
var socket = this.socket;
|
||||
var $rootScope = this.$rootScope;
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
|
||||
socket.emit(event, data, function() {
|
||||
args.push(function() {
|
||||
var args = arguments;
|
||||
$rootScope.$apply(function() {
|
||||
if (callback) {
|
||||
|
@ -48,6 +49,8 @@ ScopedSocket.prototype.emit = function(event, data, callback) {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
socket.emit.apply(socket, args);
|
||||
};
|
||||
|
||||
angular.module('insight.socket').factory('getSocket',
|
||||
|
|
Loading…
Reference in New Issue