@@ -17,10 +17,8 @@ <h1>Event Manager</h1>
1717
1818 < pre > {{ eventLog | json }}</ pre >
1919
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 >
2422
2523 </ div >
2624
@@ -42,12 +40,8 @@ <h1>Event Manager</h1>
4240
4341 events : {
4442
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 ) ;
5145 }
5246
5347 } ,
@@ -66,12 +60,12 @@ <h1>Event Manager</h1>
6660 this . eventLog . push ( ( new Date ) . getTime ( ) + ': ' + msg ) ;
6761 } ,
6862
69- triggerInstanceMethod : function ( ) {
70- this . $ trigger( 'instanceTest ' ) ;
63+ triggerGlobalMethod : function ( ) {
64+ Vue . events . trigger ( 'test' , 'Vue.events.trigger ') ;
7165 } ,
7266
73- triggerGlobalMethod : function ( ) {
74- Vue . events . trigger ( 'globalTest ' ) ;
67+ triggerInstanceMethod : function ( ) {
68+ this . $ trigger( 'test' , 'this.$trigger ') ;
7569 }
7670
7771 }
0 commit comments