ngx-socket-io
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -23,2 +23,7 @@ (function (global, factory) { | ||
} | ||
WrappedSocket.prototype.of = function (namespace, eventName, callback) { | ||
this.ioSocket | ||
.of(namespace) | ||
.on(eventName, callback); | ||
}; | ||
WrappedSocket.prototype.on = function (eventName, callback) { | ||
@@ -25,0 +30,0 @@ this.ioSocket.on(eventName, callback); |
@@ -1,1 +0,1 @@ | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("socket.io-client")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs","rxjs/operators","socket.io-client"],o):o((e.ng=e.ng||{},e.ng.socketio=e.ng.socketio||{}),e.ng.core,e.rxjs,e.Rx,e.io)}(this,function(e,o,t,n,r){"use strict";function i(e){return new s(e)}var c=r.default,s=function(){function e(e){this.subscribersCounter=0,this.emptyConfig={url:"",options:{}},void 0===e&&(e=this.emptyConfig);var o=e.url,t=e.options,n=c||r;this.ioSocket=n(o,t)}return e.prototype.on=function(e,o){this.ioSocket.on(e,o)},e.prototype.once=function(e,o){this.ioSocket.once(e,o)},e.prototype.connect=function(){return this.ioSocket.connect()},e.prototype.disconnect=function(e){return this.ioSocket.disconnect.apply(this.ioSocket,arguments)},e.prototype.emit=function(e,o,t){return this.ioSocket.emit.apply(this.ioSocket,arguments)},e.prototype.removeListener=function(e,o){return this.ioSocket.removeListener.apply(this.ioSocket,arguments)},e.prototype.removeAllListeners=function(e){return this.ioSocket.removeAllListeners.apply(this.ioSocket,arguments)},e.prototype.fromEvent=function(e){var o=this;return this.subscribersCounter++,t.Observable.create(function(t){return o.ioSocket.on(e,function(e){t.next(e)}),function(){1===o.subscribersCounter&&o.ioSocket.removeListener(e)}}).pipe(n.share())},e.prototype.fromOneTimeEvent=function(e){var o=this;return new Promise(function(t){return o.once(e,t)})},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:o.Inject,args:[u]}]}]},e}(),u=new o.InjectionToken("__SOCKET_IO_CONFIG__"),p=function(){function e(){}return e.forRoot=function(o){return{ngModule:e,providers:[{provide:u,useValue:o},{provide:s,useFactory:i,deps:[u]}]}},e.decorators=[{type:o.NgModule,args:[{}]}],e}();e.SocketIoModule=p,e.Socket=s,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("socket.io-client")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs","rxjs/operators","socket.io-client"],o):o((e.ng=e.ng||{},e.ng.socketio=e.ng.socketio||{}),e.ng.core,e.rxjs,e.Rx,e.io)}(this,function(e,o,t,n,r){"use strict";function i(e){return new s(e)}var c=r.default,s=function(){function e(e){this.subscribersCounter=0,this.emptyConfig={url:"",options:{}},void 0===e&&(e=this.emptyConfig);var o=e.url,t=e.options,n=c||r;this.ioSocket=n(o,t)}return e.prototype.of=function(e,o,t){this.ioSocket.of(e).on(o,t)},e.prototype.on=function(e,o){this.ioSocket.on(e,o)},e.prototype.once=function(e,o){this.ioSocket.once(e,o)},e.prototype.connect=function(){return this.ioSocket.connect()},e.prototype.disconnect=function(e){return this.ioSocket.disconnect.apply(this.ioSocket,arguments)},e.prototype.emit=function(e,o,t){return this.ioSocket.emit.apply(this.ioSocket,arguments)},e.prototype.removeListener=function(e,o){return this.ioSocket.removeListener.apply(this.ioSocket,arguments)},e.prototype.removeAllListeners=function(e){return this.ioSocket.removeAllListeners.apply(this.ioSocket,arguments)},e.prototype.fromEvent=function(e){var o=this;return this.subscribersCounter++,t.Observable.create(function(t){return o.ioSocket.on(e,function(e){t.next(e)}),function(){1===o.subscribersCounter&&o.ioSocket.removeListener(e)}}).pipe(n.share())},e.prototype.fromOneTimeEvent=function(e){var o=this;return new Promise(function(t){return o.once(e,t)})},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:o.Inject,args:[u]}]}]},e}(),u=new o.InjectionToken("__SOCKET_IO_CONFIG__"),p=function(){function e(){}return e.forRoot=function(o){return{ngModule:e,providers:[{provide:u,useValue:o},{provide:s,useFactory:i,deps:[u]}]}},e.decorators=[{type:o.NgModule,args:[{}]}],e}();e.SocketIoModule=p,e.Socket=s,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "ngx-socket-io", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Socket.IO module for Angular 7", | ||
@@ -35,4 +35,4 @@ "main": "index.ts", | ||
"peerDependencies": { | ||
"@angular/common": "^6.0.0-rc.0 || ^6.0.0", | ||
"@angular/core": "^6.0.0-rc.0 || ^6.0.0", | ||
"@angular/common": "^6.0.0 || ^7.0.0", | ||
"@angular/core": "^6.0.0 || ^7.0.0", | ||
"rxjs": "^6.0.0" | ||
@@ -39,0 +39,0 @@ }, |
@@ -39,32 +39,2 @@ # ngx-socket-io | ||
### For Angular 6 Project in version 1.0.8 | ||
To be sure that you are using Angular 6, check your version: | ||
```bash | ||
ng -v | ||
``` | ||
If you are using Angular 6 you need change two thing | ||
1. Install rxjs-compat | ||
```bash | ||
npm install rxjs-compat | ||
``` | ||
2. Change polyfills.ts | ||
Add this code in the first line of the file: | ||
```ts | ||
(window as any).global = window; | ||
``` | ||
### Using your socket Instance | ||
@@ -147,8 +117,13 @@ | ||
### `socket.on(eventName: string)` | ||
### `socket.of(namespace: string, eventName: string, callback: Function)` | ||
Takes an namespace name, event name and callback. | ||
Works the same as in Socket.IO. | ||
### `socket.on(eventName: string, callback: Function)` | ||
Takes an event name and callback. | ||
Works the same as in Socket.IO. | ||
### `socket.removeListener(eventName: string, callback: Function)` | ||
### `socket.removeListener(eventName: string, callback?: Function)` | ||
@@ -158,3 +133,3 @@ Takes an event name and callback. | ||
### `socket.removeAllListeners(eventName: string)` | ||
### `socket.removeAllListeners(eventName?: string)` | ||
@@ -161,0 +136,0 @@ Takes an event name. |
@@ -8,2 +8,3 @@ import { Observable } from 'rxjs'; | ||
constructor(config: SocketIoConfig); | ||
of(namespace: string, eventName: string, callback: Function): void; | ||
on(eventName: string, callback: Function): void; | ||
@@ -10,0 +11,0 @@ once(eventName: string, callback: Function): void; |
@@ -20,2 +20,7 @@ import { Inject } from '@angular/core'; | ||
} | ||
WrappedSocket.prototype.of = function (namespace, eventName, callback) { | ||
this.ioSocket | ||
.of(namespace) | ||
.on(eventName, callback); | ||
}; | ||
WrappedSocket.prototype.on = function (eventName, callback) { | ||
@@ -22,0 +27,0 @@ this.ioSocket.on(eventName, callback); |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"WrappedSocket":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":17,"character":17},"arguments":[{"__symbolic":"reference","module":"./socket-io.module","name":"SOCKET_CONFIG_TOKEN","line":17,"character":24}]}]],"parameters":[{"__symbolic":"reference","module":"./config/socket-io.config","name":"SocketIoConfig","line":17,"character":53}]}],"on":[{"__symbolic":"method"}],"once":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"emit":[{"__symbolic":"method"}],"removeListener":[{"__symbolic":"method"}],"removeAllListeners":[{"__symbolic":"method"}],"fromEvent":[{"__symbolic":"method"}],"fromOneTimeEvent":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"WrappedSocket":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":17,"character":17},"arguments":[{"__symbolic":"reference","module":"./socket-io.module","name":"SOCKET_CONFIG_TOKEN","line":17,"character":24}]}]],"parameters":[{"__symbolic":"reference","module":"./config/socket-io.config","name":"SocketIoConfig","line":17,"character":53}]}],"of":[{"__symbolic":"method"}],"on":[{"__symbolic":"method"}],"once":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"emit":[{"__symbolic":"method"}],"removeListener":[{"__symbolic":"method"}],"removeAllListeners":[{"__symbolic":"method"}],"fromEvent":[{"__symbolic":"method"}],"fromOneTimeEvent":[{"__symbolic":"method"}]}}}}] |
@@ -1,1 +0,1 @@ | ||
{"moduleName":null,"summaries":[{"symbol":{"__symbol":0,"members":[]},"metadata":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"resolved","symbol":{"__symbol":1,"members":[]},"line":17,"character":17,"fileName":"src/socket-io.service.ts"},"arguments":[{"__symbolic":"resolved","symbol":{"__symbol":2,"members":[]},"line":17,"character":24,"fileName":"src/socket-io.service.ts"}]}]],"parameters":[{"__symbolic":"resolved","symbol":{"__symbol":3,"members":[]},"line":17,"character":53,"fileName":"src/socket-io.service.ts"}]}],"on":[{"__symbolic":"method"}],"once":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"emit":[{"__symbolic":"method"}],"removeListener":[{"__symbolic":"method"}],"removeAllListeners":[{"__symbolic":"method"}],"fromEvent":[{"__symbolic":"method"}],"fromOneTimeEvent":[{"__symbolic":"method"}]}}}],"symbols":[{"__symbol":0,"name":"WrappedSocket","filePath":"./socket-io.service"},{"__symbol":1,"name":"Inject","filePath":"@angular/core/core"},{"__symbol":2,"name":"SOCKET_CONFIG_TOKEN","filePath":"./socket-io.module"},{"__symbol":3,"name":"SocketIoConfig","filePath":"./config/socket-io.config"}]} | ||
{"moduleName":null,"summaries":[{"symbol":{"__symbol":0,"members":[]},"metadata":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"resolved","symbol":{"__symbol":1,"members":[]},"line":17,"character":17,"fileName":"src/socket-io.service.ts"},"arguments":[{"__symbolic":"resolved","symbol":{"__symbol":2,"members":[]},"line":17,"character":24,"fileName":"src/socket-io.service.ts"}]}]],"parameters":[{"__symbolic":"resolved","symbol":{"__symbol":3,"members":[]},"line":17,"character":53,"fileName":"src/socket-io.service.ts"}]}],"of":[{"__symbolic":"method"}],"on":[{"__symbolic":"method"}],"once":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"emit":[{"__symbolic":"method"}],"removeListener":[{"__symbolic":"method"}],"removeAllListeners":[{"__symbolic":"method"}],"fromEvent":[{"__symbolic":"method"}],"fromOneTimeEvent":[{"__symbolic":"method"}]}}}],"symbols":[{"__symbol":0,"name":"WrappedSocket","filePath":"./socket-io.service"},{"__symbol":1,"name":"Inject","filePath":"@angular/core/core"},{"__symbol":2,"name":"SOCKET_CONFIG_TOKEN","filePath":"./socket-io.module"},{"__symbol":3,"name":"SocketIoConfig","filePath":"./config/socket-io.config"}]} |
Sorry, the diff of this file is not supported yet
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
32262
249
163