File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export default {
10
10
throw new Error ( "[Vue-Echo] cannot initiate options" ) ;
11
11
}
12
12
13
- if ( typeof options == 'function' )
13
+ if ( typeof options . socketId == 'function' )
14
14
{
15
15
Vue . prototype . $echo = options ;
16
16
}
@@ -28,6 +28,7 @@ export default {
28
28
if ( channel . startsWith ( 'private:' ) )
29
29
{
30
30
this . channel = this . $echo . private ( channel . replace ( 'private:' , '' ) )
31
+ console . log ( this . channel ) ;
31
32
}
32
33
else if ( channel . startsWith ( 'presence:' ) )
33
34
{
@@ -43,7 +44,10 @@ export default {
43
44
if ( events )
44
45
{
45
46
Object . keys ( events ) . forEach ( function ( key ) {
46
- this . channel . listen ( key , events [ key ] ) ;
47
+ // Bind the VM as second parameter
48
+ this . channel . listen ( key , ( payload ) => {
49
+ events [ key ] ( payload , this ) ;
50
+ } ) ;
47
51
} , this ) ;
48
52
}
49
53
}
@@ -55,4 +59,4 @@ export default {
55
59
}
56
60
} )
57
61
}
58
- }
62
+ }
You can’t perform that action at this time.
0 commit comments