Socket
Socket
Sign inDemoInstall

angular-socket-io

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-socket-io - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

2

bower.json
{
"name": "angular-socket-io",
"version": "0.5.0",
"version": "0.6.0",
"main": "socket.js",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -35,3 +35,11 @@ var io = {

}
}
},
removeAllListeners: function (ev) {
if (ev) {
delete this._listeners[ev];
} else {
this._listeners = {};
}
},
disconnect: function () {}
};

@@ -38,0 +46,0 @@

{
"name": "angular-socket-io",
"version": "0.5.0",
"version": "0.6.0",
"main": "socket.js",

@@ -5,0 +5,0 @@ "directories": {

@@ -1,2 +0,3 @@

# angular-socket-io
# angular-socket-io [![Build Status](https://travis-ci.org/btford/angular-socket-io.png)](https://travis-ci.org/btford/angular-socket-io)
Bower Component for using AngularJS with [Socket.IO](http://socket.io/),

@@ -68,2 +69,6 @@ based on [this](http://briantford.com/blog/angular-socket-io.html).

### `socket.removeAllListeners`
Takes an event name.
Works just like the method of the same name from Socket.IO.
### `socket.emit`

@@ -70,0 +75,0 @@ Sends a message to the server.

/*
* @license
* angular-socket-io v0.5.0
* angular-socket-io v0.6.0
* (c) 2014 Brian Ford http://briantford.com

@@ -8,7 +8,7 @@ * License: MIT

'use strict';
angular.module('btford.socket-io', []).
provider('socketFactory', function () {
'use strict';
// when forwarding events, prefix the event name

@@ -66,2 +66,10 @@ var defaultPrefix = 'socket:',

removeAllListeners: function() {
return socket.removeAllListeners.apply(socket, arguments);
},
disconnect: function (close) {
return socket.disconnect(close);
},
// when socket.on('someEvent', fn (data) { ... }),

@@ -68,0 +76,0 @@ // call scope.$broadcast('someEvent', data)

/*
* @license
* angular-socket-io v0.5.0
* angular-socket-io v0.6.0
* (c) 2014 Brian Ford http://briantford.com
* License: MIT
*/
"use strict";angular.module("btford.socket-io",[]).provider("socketFactory",function(){var n="socket:";this.$get=["$rootScope","$timeout",function(t,o){var e=function(n,t){return t?function(){var e=arguments;o(function(){t.apply(n,e)},0)}:angular.noop};return function(o){o=o||{};var r=o.ioSocket||io.connect(),u=o.prefix||n,c=o.scope||t,i=function(n,t){r.on(n,t.__ng=e(r,t))},a=function(n,t){r.once(n,t.__ng=e(r,t))},f={on:i,addListener:i,once:a,emit:function(n,t,o){var u=arguments.length-1,o=arguments[u];return"function"==typeof o&&(o=e(r,o),arguments[u]=o),r.emit.apply(r,arguments)},removeListener:function(n,t){return t&&t.__ng&&(arguments[1]=t.__ng),r.removeListener.apply(r,arguments)},forward:function(n,t){n instanceof Array==!1&&(n=[n]),t||(t=c),n.forEach(function(n){var o=u+n,c=e(r,function(n){t.$broadcast(o,n)});t.$on("$destroy",function(){r.removeListener(n,c)}),r.on(n,c)})}};return f}}]});
angular.module("btford.socket-io",[]).provider("socketFactory",function(){"use strict";var n="socket:";this.$get=["$rootScope","$timeout",function(t,e){var o=function(n,t){return t?function(){var o=arguments;e(function(){t.apply(n,o)},0)}:angular.noop};return function(e){e=e||{};var r=e.ioSocket||io.connect(),u=e.prefix||n,c=e.scope||t,i=function(n,t){r.on(n,t.__ng=o(r,t))},a=function(n,t){r.once(n,t.__ng=o(r,t))},s={on:i,addListener:i,once:a,emit:function(n,t,e){var u=arguments.length-1,e=arguments[u];return"function"==typeof e&&(e=o(r,e),arguments[u]=e),r.emit.apply(r,arguments)},removeListener:function(n,t){return t&&t.__ng&&(arguments[1]=t.__ng),r.removeListener.apply(r,arguments)},removeAllListeners:function(){return r.removeAllListeners.apply(r,arguments)},disconnect:function(n){return r.disconnect(n)},forward:function(n,t){n instanceof Array==!1&&(n=[n]),t||(t=c),n.forEach(function(n){var e=u+n,c=o(r,function(n){t.$broadcast(e,n)});t.$on("$destroy",function(){r.removeListener(n,c)}),r.on(n,c)})}};return s}}]});

@@ -50,2 +50,13 @@ /*

describe('#disconnect', function () {
it('should call the underlying socket.disconnect', function () {
mockIoSocket.disconnect = spy;
socket.disconnect();
expect(spy).toHaveBeenCalled();
});
});
describe('#once', function () {

@@ -125,2 +136,27 @@

describe('#removeAllListeners', function () {
it('should not call after removing listeners for an event', function () {
socket.on('event', spy);
socket.removeAllListeners('event');
mockIoSocket.emit('event');
expect($browser.deferredFns.length).toBe(0);
});
it('should not call after removing all listeners', function () {
socket.on('event', spy);
socket.on('event2', spy);
socket.removeAllListeners();
mockIoSocket.emit('event');
mockIoSocket.emit('event2');
expect($browser.deferredFns.length).toBe(0);
});
});
describe('#forward', function () {

@@ -127,0 +163,0 @@

Sorry, the diff of this file is not supported yet

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