angular-phoenix
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "angular-phoenix", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "MikaAK <mikakalathil@gmail.com>" |
@@ -10,8 +10,17 @@ "use strict"; | ||
this.$get = ["$rootScope", "PhoenixBase", function ($rootScope, PhoenixBase) { | ||
var socket = new PhoenixBase.Socket(urlBase), | ||
this.$get = ["$rootScope", "$window", "PhoenixBase", function ($rootScope, $window, PhoenixBase) { | ||
var createSocketUrl = function createSocketUrl(url) { | ||
var loc = $window.location, | ||
socketProtocol = loc.protocol === "http:" ? "ws:" : "wss:", | ||
baseUrl = url.startsWith("/") ? url.substr(1, url.length) : url; | ||
return "" + socketProtocol + "//" + loc.host + "" + loc.pathname + "" + baseUrl; | ||
}; | ||
var socketUrl = urlBase.search("ws") === 0 ? urlBase : createSocketUrl(urlBase), | ||
socket = new PhoenixBase.Socket(urlBase), | ||
channels = new Map(); | ||
return { | ||
phoenix: PhoenixBase, | ||
base: PhoenixBase, | ||
socket: socket, | ||
@@ -18,0 +27,0 @@ leave: function leave(name) { |
{ | ||
"name": "angular-phoenix", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Native bindings for phoenix in angular", | ||
@@ -5,0 +5,0 @@ "main": "dist/angular-phoenix.js", |
@@ -14,3 +14,3 @@ Angular Phoenix | ||
**__Note:__** You must have the original `phoenix.js` loaded prior to this | ||
**__Note:__** You must have the original `phoenix.js` loaded prior to this, it also makes use of promises so please have a promise library loaded or be using ES6! | ||
@@ -17,0 +17,0 @@ ### How to use |
@@ -10,4 +10,13 @@ 'use strict' | ||
this.$get = ['$rootScope', 'PhoenixBase', ($rootScope, PhoenixBase) => { | ||
var socket = new PhoenixBase.Socket(urlBase), | ||
this.$get = ['$rootScope', '$window', 'PhoenixBase', ($rootScope, $window, PhoenixBase) => { | ||
var createSocketUrl = function(url) { | ||
var loc = $window.location, | ||
socketProtocol = loc.protocol === 'http:' ? 'ws:' : 'wss:', | ||
baseUrl = url.startsWith('/') ? url.substr(1, url.length) : url | ||
return `${socketProtocol}//${loc.host}${loc.pathname}${baseUrl}` | ||
} | ||
var socketUrl = urlBase.search('ws') === 0 ? urlBase : createSocketUrl(urlBase), | ||
socket = new PhoenixBase.Socket(urlBase), | ||
channels = new Map() | ||
@@ -14,0 +23,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
9152
146