@@ -17,10 +17,8 @@ <h1>Event Manager</h1>
17
17
18
18
< pre > {{ eventLog | json }}</ pre >
19
19
20
- < button class ="btn btn-primary " type ="button " @click ="triggerInstanceMethod "> Trigger 'instanceTest' event using instance method</ button >
21
-
22
- < button class ="btn btn-primary " type ="button " @click ="triggerGlobalMethod "> Trigger 'globalTest' event using global method</ button >
23
-
20
+ < button class ="btn btn-primary " type ="button " @click ="triggerGlobalMethod "> Trigger 'test' event using global method</ button >
21
+ < button class ="btn btn-primary " type ="button " @click ="triggerInstanceMethod "> Trigger 'test' event using instance method</ button >
24
22
25
23
</ div >
26
24
@@ -42,12 +40,8 @@ <h1>Event Manager</h1>
42
40
43
41
events : {
44
42
45
- instanceTest : function ( ) {
46
- this . pushLog ( '\'instanceTest\' event executed' ) ;
47
- } ,
48
-
49
- globalTest : function ( ) {
50
- this . pushLog ( '\'globalTest\' event executed' ) ;
43
+ test : function ( fn ) {
44
+ this . pushLog ( '\'test\' event executed using ' + fn ) ;
51
45
}
52
46
53
47
} ,
@@ -66,12 +60,12 @@ <h1>Event Manager</h1>
66
60
this . eventLog . push ( ( new Date ) . getTime ( ) + ': ' + msg ) ;
67
61
} ,
68
62
69
- triggerInstanceMethod : function ( ) {
70
- this . $ trigger( 'instanceTest ' ) ;
63
+ triggerGlobalMethod : function ( ) {
64
+ Vue . events . trigger ( 'test' , 'Vue.events.trigger ') ;
71
65
} ,
72
66
73
- triggerGlobalMethod : function ( ) {
74
- Vue . events . trigger ( 'globalTest ' ) ;
67
+ triggerInstanceMethod : function ( ) {
68
+ this . $ trigger( 'test' , 'this.$trigger ') ;
75
69
}
76
70
77
71
}
0 commit comments