File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 110110 }
111111
112112 // `dispatch` method dispatch the event with `data` (or **payload**)
113- Dispatcher . prototype . dispatch = function ( actionName , data ) {
114- var self = this , stores , deferred ;
115-
116- this . listener . emit ( 'dispatch' , actionName , data ) ;
113+ Dispatcher . prototype . dispatch = function ( ) {
114+ var self = this , stores , deferred , args ;
115+ args = Array . prototype . slice . call ( arguments ) ;
116+
117+ this . listener . emit . apply ( this . listener , [ 'dispatch' ] . concat ( args ) ) ;
118+
117119 /* Stores are key-value pairs. Collect store instances into an array. */
118120 stores = ( function ( ) {
119121 var stores = [ ] , store ;
130132
131133 // Store instances should wait for finish. So you can know if all the
132134 // stores are dispatched properly.
133- deferred = this . waitFor ( stores , actionName ) ;
135+ deferred = this . waitFor ( stores , args [ 0 ] ) ;
134136
135137 /* Payload should send to all related stores. */
136138 for ( var storeName in self . stores ) {
137- self . stores [ storeName ] . dispatchAction ( actionName , data ) ;
139+ self . stores [ storeName ] . dispatchAction . apply ( self . stores [ storeName ] , args ) ;
138140 }
139141
140142 // `dispatch` returns deferred object you can just use **promise**
You can’t perform that action at this time.
0 commit comments