Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-phoenix

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-phoenix - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

19

dist/angular-phoenix.js
'use strict';
angular.module('angular-phoenix', []).value('PhoenixBase', Phoenix).provider('Phoenix', [function () {
var _this3 = this;
var urlBase = '/ws',

@@ -13,2 +15,3 @@ _autoJoinSocket = true;

};
this.defaults = null;

@@ -36,7 +39,3 @@ this.$get = ['$q', '$rootScope', 'PhoenixBase', function ($q, $rootScope, PhoenixBase) {

newCallback = function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
callback.apply(undefined, args);
callback.apply(undefined, arguments);
$rootScope.$apply();

@@ -77,4 +76,12 @@ };

if (_autoJoinSocket) socket.connect();
if (_autoJoinSocket) socket.connect(_this3.defaults || {});else {
var _socket$connect;
var args = [socket];
if (_this3.defaults) args.push(_this3.defaults);
socket.connect = (_socket$connect = socket.connect).bind.apply(_socket$connect, args);
}
socket.PhoenixBase = PhoenixBase;

@@ -81,0 +88,0 @@

{
"name": "angular-phoenix",
"version": "0.3.1",
"version": "0.4.0",
"description": "Native bindings for phoenix in angular",

@@ -5,0 +5,0 @@ "main": "dist/angular-phoenix.js",

@@ -26,6 +26,13 @@ Angular Phoenix

PhoenixProviver.setAutoJoin(false) // Phoenix will autojoin the socket unless this is called
// set default params with autojoin or connect
PhoenixProvider.defaults = {
user: 1
}
}])
```
**Note:** Phoenix when injected will be a instance of `Phoenix.Socket`
**Note:** Phoenix when injected will be a instance of `Phoenix.Socket` and will connect instantly unless
`autoJoin` is false.
**If not with `autoJoin`:** defaults will still apply to Socket.connect() however you can pass custom ones to override
**__Now were ready!!!__**

@@ -40,7 +47,10 @@

// This callback will get removed on scope destruction
chan.on(scope, 'message', handler)
// This will never be destroyed
chnn.on('message', hander)
chan.join()
.receive(chann => {
// Now our callbacks will get removed on scope destruction
chann.on(scope, 'message', handler)
chann.on('message', hander)
.receive('ok', message => {
})

@@ -75,3 +85,3 @@

// Alternatively with no resolve
var chan = Phoenix.chan('chatRoom')
var chan = Phoenix.chan('chatRoom', userParams)

@@ -78,0 +88,0 @@ chan.join()

@@ -11,2 +11,3 @@ 'use strict'

this.setAutoJoin = bool => _autoJoinSocket = bool
this.defaults = null

@@ -64,4 +65,12 @@ this.$get = ['$q', '$rootScope', 'PhoenixBase', ($q, $rootScope, PhoenixBase) => {

if (_autoJoinSocket)
socket.connect()
socket.connect(this.defaults || {})
else {
let args = [socket]
if (this.defaults)
args.push(this.defaults)
socket.connect = socket.connect.bind(...args)
}
socket.PhoenixBase = PhoenixBase

@@ -68,0 +77,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc