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 socket = getSocket($scope);
|
||||||
|
|
||||||
var _startSocket = function () {
|
var _startSocket = function () {
|
||||||
socket.emit('subscribe', $routeParams.addrStr);
|
socket.on('bitcoind/addresstxid', function(tx) {
|
||||||
socket.on($routeParams.addrStr, function(tx) {
|
|
||||||
$rootScope.$broadcast('tx', tx);
|
$rootScope.$broadcast('tx', tx);
|
||||||
var beep = new Audio('/sound/transaction.mp3');
|
var beep = new Audio('/sound/transaction.mp3');
|
||||||
beep.play();
|
beep.play();
|
||||||
});
|
});
|
||||||
|
socket.emit('subscribe', 'bitcoind/addresstxid', [$routeParams.addrStr]);
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.on('connect', function() {
|
socket.on('connect', function() {
|
||||||
|
|
|
@ -39,8 +39,9 @@ ScopedSocket.prototype.on = function(event, callback) {
|
||||||
ScopedSocket.prototype.emit = function(event, data, callback) {
|
ScopedSocket.prototype.emit = function(event, data, callback) {
|
||||||
var socket = this.socket;
|
var socket = this.socket;
|
||||||
var $rootScope = this.$rootScope;
|
var $rootScope = this.$rootScope;
|
||||||
|
var args = Array.prototype.slice.call(arguments);
|
||||||
|
|
||||||
socket.emit(event, data, function() {
|
args.push(function() {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
$rootScope.$apply(function() {
|
$rootScope.$apply(function() {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
@ -48,6 +49,8 @@ ScopedSocket.prototype.emit = function(event, data, callback) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.emit.apply(socket, args);
|
||||||
};
|
};
|
||||||
|
|
||||||
angular.module('insight.socket').factory('getSocket',
|
angular.module('insight.socket').factory('getSocket',
|
||||||
|
|
Loading…
Reference in New Issue