Add options parameter to Constructor (#195)

* Fix Spelling

- Rename `Listenler` to `Listener`

* Add Options to Connection

- Add options which can be passed to connection string for `SocketIO`

* Build New Version

* Fix spelling in Package.json

- Change `implemantation` to `implementation`
- Change `vuejs` to `Vue.js`
- Change `vuex` to `VueX`

* Updates to index.js

- Add `options` to JSDocs for constructor
- Fix spelling for JSDoc on `install` and `connect` methods
pull/198/head
Evan bechtol 5 years ago committed by Metin Seylan
parent 207a0a13bd
commit f1e03525c0

File diff suppressed because one or more lines are too long

@ -2,7 +2,7 @@
"name": "vue-socket.io",
"author": "Metin Seylan <metinsyln@gmail.com>",
"version": "3.0.5",
"description": "socket.io implemantation for vuejs and vuex",
"description": "socket.io implementation for Vue.js and Vuex",
"main": "dist/vue-socketio.js",
"scripts": {
"build": "webpack --mode=production --progress --hide-modules"

@ -1,6 +1,6 @@
import Mixin from './mixin';
import Logger from './logger';
import Listenler from './listenler';
import Listener from './listener';
import Emitter from './emitter';
import SocketIO from 'socket.io-client';
@ -11,18 +11,19 @@ export default class VueSocketIO {
* @param io
* @param vuex
* @param debug
* @param options
*/
constructor({connection, vuex, debug}){
constructor({connection, vuex, debug, options}){
Logger.debug = debug;
this.io = this.connect(connection);
this.io = this.connect(connection, options);
this.emitter = new Emitter(vuex);
this.listener = new Listenler(this.io, this.emitter);
this.listener = new Listener(this.io, this.emitter);
}
/**
* Vuejs entrypoint
* Vue.js entry point
* @param Vue
*/
install(Vue){
@ -37,10 +38,11 @@ export default class VueSocketIO {
/**
* registering socketio instance
* registering SocketIO instance
* @param connection
* @param options
*/
connect(connection){
connect(connection, options){
if(connection && typeof connection === 'object'){
@ -52,7 +54,7 @@ export default class VueSocketIO {
Logger.info('Received connection string');
return this.io = SocketIO(connection);
return this.io = SocketIO(connection, options);
} else {

@ -1,5 +1,5 @@
export default class VueSocketIOListenler {
export default class VueSocketIOListener {
/**
* socket.io-client reserved event keywords
Loading…
Cancel
Save