laravel-echo
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -163,3 +163,3 @@ 'use strict'; | ||
/** | ||
* Register a callback to be called on successfully joining the channel. | ||
* Register a callback to be called anytime the member list changes. | ||
*/ | ||
@@ -169,5 +169,30 @@ | ||
_createClass(EchoPresenceChannel, [{ | ||
key: 'here', | ||
value: function here(callback) { | ||
var _this = this; | ||
this.then(callback); | ||
var addedOrRemovedCallback = function addedOrRemovedCallback(member) { | ||
var members = Object.keys(_this.channel.members.members).map(function (k) { | ||
return _this.channel.members.members[k]; | ||
}); | ||
callback(member.info, members, _this.channel); | ||
}; | ||
this.channel.bind('pusher:member_added', addedOrRemovedCallback); | ||
this.channel.bind('pusher:member_removed', addedOrRemovedCallback); | ||
return this; | ||
} | ||
/** | ||
* Register a callback to be called on successfully joining the channel. | ||
*/ | ||
}, { | ||
key: 'then', | ||
value: function then(callback) { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -179,3 +204,3 @@ this.channel.bind('pusher:subscription_succeeded', function (message) { | ||
callback(members, _this.channel); | ||
callback(members, _this2.channel); | ||
}); | ||
@@ -193,10 +218,10 @@ | ||
value: function joining(callback) { | ||
var _this2 = this; | ||
var _this3 = this; | ||
this.channel.bind('pusher:member_added', function (member) { | ||
var members = Object.keys(_this2.channel.members.members).map(function (k) { | ||
return _this2.channel.members.members[k]; | ||
var members = Object.keys(_this3.channel.members.members).map(function (k) { | ||
return _this3.channel.members.members[k]; | ||
}); | ||
callback(member.info, members, _this2.channel); | ||
callback(member.info, members, _this3.channel); | ||
}); | ||
@@ -214,10 +239,10 @@ | ||
value: function leaving(callback) { | ||
var _this3 = this; | ||
var _this4 = this; | ||
this.channel.bind('pusher:member_removed', function (member) { | ||
var members = Object.keys(_this3.channel.members.members).map(function (k) { | ||
return _this3.channel.members.members[k]; | ||
var members = Object.keys(_this4.channel.members.members).map(function (k) { | ||
return _this4.channel.members.members[k]; | ||
}); | ||
callback(member.info, members, _this3.channel); | ||
callback(member.info, members, _this4.channel); | ||
}); | ||
@@ -235,6 +260,6 @@ | ||
value: function listen(event, callback) { | ||
var _this4 = this; | ||
var _this5 = this; | ||
this.channel.bind(EchoEventFormatter.format(event), function (data) { | ||
callback(data, _this4.channel); | ||
callback(data, _this5.channel); | ||
}); | ||
@@ -241,0 +266,0 @@ |
{ | ||
"name": "laravel-echo", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Laravel Echo library for beautiful Pusher integration", | ||
@@ -5,0 +5,0 @@ "main": "dist/echo.js", |
11038
267