angular-phoenix
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "angular-phoenix", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "MikaAK <mikakalathil@gmail.com>" |
@@ -115,2 +115,4 @@ 'use strict'; | ||
channels.set(name, { status: 'connected', channel: channel, promise: promise }); | ||
}, function () { | ||
return console.warn('connection timed out...'); | ||
}); | ||
@@ -123,10 +125,20 @@ | ||
PhoenixBase.Channel.prototype.leave = function () { | ||
var _oldLeave = angular.copy(phoenix.Channel.prototype.leave); | ||
return function leave() { | ||
channels.set(this.topic, { status: 'disconnected' }); | ||
return _oldLeave.call(this); | ||
}; | ||
}; | ||
return { | ||
base: PhoenixBase, | ||
socket: socket, | ||
leave: function leave(name) { | ||
if (!channels.get(name)) { | ||
leave: function leave(chan) { | ||
var channel = channels.get(chan.topic); | ||
if (!channel || channel.status === 'disconnected') { | ||
return; | ||
}socket.leave(name); | ||
channels.set(name, { status: 'disconnected' }); | ||
}channel.leave(); | ||
}, | ||
@@ -133,0 +145,0 @@ |
{ | ||
"name": "angular-phoenix", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Native bindings for phoenix in angular", | ||
@@ -5,0 +5,0 @@ "main": "dist/angular-phoenix.js", |
@@ -84,5 +84,5 @@ 'use strict' | ||
this.$get = ['PhoenixBase', (PhoenixBase) => { | ||
var socket = new PhoenixBase.Socket(urlBase), | ||
channels = new Map(), | ||
joinChannel= (name, message) => { | ||
var socket = new PhoenixBase.Socket(urlBase), | ||
channels = new Map(), | ||
joinChannel = (name, message) => { | ||
var joinRes, | ||
@@ -107,3 +107,3 @@ promise, | ||
channels.set(name, {status: 'connected', channel, promise}) | ||
}) | ||
}, () => console.warn('connection timed out...')) | ||
@@ -116,11 +116,22 @@ return angular.extend(channel, {promise}) | ||
PhoenixBase.Channel.prototype.leave = (() => { | ||
var _oldLeave = angular.copy(PhoenixBase.Channel.prototype.leave) | ||
return function leave() { | ||
channels.set(this.topic, {status: 'disconnected'}) | ||
return _oldLeave.call(this) | ||
} | ||
})(); | ||
return { | ||
base: PhoenixBase, | ||
socket: socket, | ||
leave(name) { | ||
if (!channels.get(name)) | ||
leave(chan) { | ||
var channel = channels.get(chan.topic) | ||
if (!channel || channel.status === 'disconnected') | ||
return | ||
socket.leave(name) | ||
channels.set(name, {status: 'disconnected'}) | ||
channel.leave() | ||
}, | ||
@@ -127,0 +138,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12988
260