@awamwang/vue-socket.io-extended
Version:
Socket.io bindings for Vue.js and Vuex (inspired by Vue-Socket.io)
28 lines (24 loc) • 669 B
TypeScript
/**
* Extends interfaces in Vue.js
*/
import { App } from "vue";
import * as SocketIOClient from 'socket.io-client';
type DefaultSocketHandlers = {
[key: string]: (...args: any[]) => any
};
import { ComponentCustomOptions } from 'vue';
import { ComponentCustomProperties } from 'vue';
declare module '@vue/runtime-core' {
interface ComponentCustomOptions {
sockets?: DefaultSocketHandlers;
}
interface ComponentCustomProperties {
$socket: {
client: SocketIOClient.Socket;
$subscribe: (event: string, fn: Function) => void;
$unsubscribe: (event: string) => void;
connected: boolean;
disconnected: boolean;
};
}
}