mirror of
https://github.com/MetinSeylan/Vue-Socket.io.git
synced 2025-04-16 15:21:28 +02:00
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
This commit is contained in:
parent
207a0a13bd
commit
f1e03525c0
4 changed files with 13 additions and 11 deletions
2
dist/vue-socketio.js
vendored
2
dist/vue-socketio.js
vendored
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
||||||
"name": "vue-socket.io",
|
"name": "vue-socket.io",
|
||||||
"author": "Metin Seylan <metinsyln@gmail.com>",
|
"author": "Metin Seylan <metinsyln@gmail.com>",
|
||||||
"version": "3.0.5",
|
"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",
|
"main": "dist/vue-socketio.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --mode=production --progress --hide-modules"
|
"build": "webpack --mode=production --progress --hide-modules"
|
||||||
|
|
18
src/index.js
18
src/index.js
|
@ -1,6 +1,6 @@
|
||||||
import Mixin from './mixin';
|
import Mixin from './mixin';
|
||||||
import Logger from './logger';
|
import Logger from './logger';
|
||||||
import Listenler from './listenler';
|
import Listener from './listener';
|
||||||
import Emitter from './emitter';
|
import Emitter from './emitter';
|
||||||
import SocketIO from 'socket.io-client';
|
import SocketIO from 'socket.io-client';
|
||||||
|
|
||||||
|
@ -11,18 +11,19 @@ export default class VueSocketIO {
|
||||||
* @param io
|
* @param io
|
||||||
* @param vuex
|
* @param vuex
|
||||||
* @param debug
|
* @param debug
|
||||||
|
* @param options
|
||||||
*/
|
*/
|
||||||
constructor({connection, vuex, debug}){
|
constructor({connection, vuex, debug, options}){
|
||||||
|
|
||||||
Logger.debug = debug;
|
Logger.debug = debug;
|
||||||
this.io = this.connect(connection);
|
this.io = this.connect(connection, options);
|
||||||
this.emitter = new Emitter(vuex);
|
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
|
* @param Vue
|
||||||
*/
|
*/
|
||||||
install(Vue){
|
install(Vue){
|
||||||
|
@ -37,10 +38,11 @@ export default class VueSocketIO {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* registering socketio instance
|
* registering SocketIO instance
|
||||||
* @param connection
|
* @param connection
|
||||||
|
* @param options
|
||||||
*/
|
*/
|
||||||
connect(connection){
|
connect(connection, options){
|
||||||
|
|
||||||
if(connection && typeof connection === 'object'){
|
if(connection && typeof connection === 'object'){
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ export default class VueSocketIO {
|
||||||
|
|
||||||
Logger.info('Received connection string');
|
Logger.info('Received connection string');
|
||||||
|
|
||||||
return this.io = SocketIO(connection);
|
return this.io = SocketIO(connection, options);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
export default class VueSocketIOListenler {
|
export default class VueSocketIOListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* socket.io-client reserved event keywords
|
* socket.io-client reserved event keywords
|
Loading…
Add table
Reference in a new issue