added 2 way communication for latest block on external api
This commit is contained in:
parent
18ea9f106d
commit
3108961c59
@ -15,6 +15,19 @@ var Collection = function Collection(externalAPI)
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Collection.prototype.setupSockets = function()
|
||||||
|
{
|
||||||
|
this._externalAPI.on('connection', function (spark)
|
||||||
|
{
|
||||||
|
this._externalAPI.on('latestBlock', function (data)
|
||||||
|
{
|
||||||
|
spark.emit('latestBlock', {
|
||||||
|
number: this._highestBlock
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Collection.prototype.add = function(data, callback)
|
Collection.prototype.add = function(data, callback)
|
||||||
{
|
{
|
||||||
var node = this.getNodeOrNew({ id : data.id }, data);
|
var node = this.getNodeOrNew({ id : data.id }, data);
|
||||||
|
Loading…
Reference in New Issue
Block a user