mirror of
https://github.com/MetinSeylan/Vue-Socket.io.git
synced 2025-04-16 15:21:28 +02:00
update
This commit is contained in:
parent
cec2a185f5
commit
d4bb50597b
1 changed files with 11 additions and 3 deletions
14
index.d.ts
vendored
14
index.d.ts
vendored
|
@ -11,12 +11,20 @@ import { PluginFunction, PluginObject } from "vue";
|
||||||
import { Store } from "vuex";
|
import { Store } from "vuex";
|
||||||
|
|
||||||
interface socketHandler<T> {
|
interface socketHandler<T> {
|
||||||
(this: T, ...args: any[]): SocketIOClient.Socket
|
(this: T, ...args: any[]): void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Sockets<V> {
|
||||||
|
[key: string]: socketHandler<V>
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'vue/types/vue' {
|
declare module 'vue/types/vue' {
|
||||||
interface Vue {
|
interface Vue {
|
||||||
$socket: SocketIOClient.Socket
|
$socket: SocketIOClient.Socket,
|
||||||
|
sockets: {
|
||||||
|
subscribe(eventName: string, handler: socketHandler<Vue>): void,
|
||||||
|
unsubscribe(eventName: string): void,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +36,7 @@ declare module 'vue/types/options' {
|
||||||
Computed=DefaultComputed,
|
Computed=DefaultComputed,
|
||||||
PropsDef=PropsDefinition<DefaultProps>,
|
PropsDef=PropsDefinition<DefaultProps>,
|
||||||
Props=DefaultProps> {
|
Props=DefaultProps> {
|
||||||
sockets: {[key: string]: socketHandler<V>}
|
sockets?: Sockets<V>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue