laravel-echo
Advanced tools
Comparing version 1.1.4 to 1.2.0
@@ -185,3 +185,3 @@ var asyncGenerator = function () { | ||
authEndpoint: '/broadcasting/auth', | ||
connector: 'pusher', | ||
broadcaster: 'pusher', | ||
csrfToken: null, | ||
@@ -208,8 +208,7 @@ host: null, | ||
value: function csrfToken() { | ||
var selector = document.querySelector('meta[name="csrf-token"]'); | ||
if (window['Laravel'] && window['Laravel'].csrfToken) { | ||
if (window && window['Laravel'] && window['Laravel'].csrfToken) { | ||
return window['Laravel'].csrfToken; | ||
} else if (this.options.csrfToken) { | ||
return this.options.csrfToken; | ||
} else if (selector) { | ||
} else if (document && (selector = document.querySelector('meta[name="csrf-token"]'))) { | ||
return selector.getAttribute('content'); | ||
@@ -298,2 +297,7 @@ } | ||
}, { | ||
key: 'listenForWhisper', | ||
value: function listenForWhisper(event, callback) { | ||
return this.listen('.client-' + event, callback); | ||
} | ||
}, { | ||
key: 'on', | ||
@@ -308,2 +312,20 @@ value: function on(event, callback) { | ||
var PusherPrivateChannel = function (_PusherChannel) { | ||
inherits(PusherPrivateChannel, _PusherChannel); | ||
function PusherPrivateChannel() { | ||
classCallCheck(this, PusherPrivateChannel); | ||
return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments)); | ||
} | ||
createClass(PusherPrivateChannel, [{ | ||
key: 'whisper', | ||
value: function whisper(eventName, data) { | ||
this.pusher.channels.channels[this.name].trigger('client-' + eventName, data); | ||
return this; | ||
} | ||
}]); | ||
return PusherPrivateChannel; | ||
}(PusherChannel); | ||
var PusherPresenceChannel = function (_PusherChannel) { | ||
@@ -343,2 +365,8 @@ inherits(PusherPresenceChannel, _PusherChannel); | ||
} | ||
}, { | ||
key: 'whisper', | ||
value: function whisper(eventName, data) { | ||
this.pusher.channels.channels[this.name].trigger('client-' + eventName, data); | ||
return this; | ||
} | ||
}]); | ||
@@ -504,3 +532,3 @@ return PusherPresenceChannel; | ||
if (!this.channels['private-' + name]) { | ||
this.channels['private-' + name] = new PusherChannel(this.pusher, 'private-' + name, this.options); | ||
this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options); | ||
} | ||
@@ -507,0 +535,0 @@ return this.channels['private-' + name]; |
{ | ||
"name": "laravel-echo", | ||
"version": "1.1.4", | ||
"description": "Laravel Echo library for beautiful Pusher integration", | ||
"version": "1.2.0", | ||
"description": "Laravel Echo library for beautiful Pusher and Socket.IO integration", | ||
"main": "dist/echo.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
128494
2944