File tree Expand file tree Collapse file tree 6 files changed +25
-9
lines changed Expand file tree Collapse file tree 6 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 1
- node_modules
2
1
coverage
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ information on how our projects are organized and how to get started.
131
131
132
132
<img src =" http://i.imgur.com/dCjNisP.png " >
133
133
134
- [ trails-image ] : http://i.imgur.com/zfT2NEv .png
134
+ [ trails-image ] : http://i.imgur.com/0iVVRxi .png
135
135
[ trails-url ] : http://trailsjs.io
136
136
[ npm-image ] : https://img.shields.io/npm/v/trails.svg?style=flat-square
137
137
[ npm-url ] : https://npmjs.org/package/trails
Original file line number Diff line number Diff line change 6
6
],
7
7
"main" : " index.js" ,
8
8
"dependencies" : {
9
- "trailpack-core" : " ^1.0.0 " ,
10
- "trailpack-repl" : " ^1.0.8 " ,
11
- "trailpack-router" : " ^1.0.2 " ,
12
- "trails" : " ^1.0.4 " ,
9
+ "trailpack-core" : " ^1.0.1 " ,
10
+ "trailpack-repl" : " ^1.1.0 " ,
11
+ "trailpack-router" : " ^1.0.8 " ,
12
+ "trails" : " ^1.1.0 " ,
13
13
"trails-controller" : " ^1.0.0-beta-2" ,
14
14
"trails-model" : " ^1.0.0-beta-2" ,
15
15
"trails-policy" : " ^1.0.1" ,
Original file line number Diff line number Diff line change @@ -164,13 +164,15 @@ module.exports = class TrailsApp extends events.EventEmitter {
164
164
* Extend the once emiter reader for accept multi valid events
165
165
*/
166
166
onceAny ( events , handler ) {
167
+ const self = this
168
+
167
169
if ( ! events )
168
170
return
169
- if ( ! ( events instanceof Array ) )
171
+ if ( ! Array . isArray ( events ) )
170
172
events = [ events ]
171
173
172
- const cb = ( e ) => {
173
- this . removeListener ( e , cb )
174
+ function cb ( e ) {
175
+ self . removeListener ( e , cb )
174
176
handler . apply ( this , Array . prototype . slice . call ( arguments , 0 ) )
175
177
}
176
178
Original file line number Diff line number Diff line change 24
24
"coverage" : " istanbul cover _mocha" ,
25
25
"ci" : " cd .. && ci"
26
26
},
27
+ "pre-commit" : [
28
+ " test"
29
+ ],
27
30
"repository" : {
28
31
"type" : " git" ,
29
32
"url" : " git+https://github.com/trailsjs/trails.git"
67
70
"eslint-config-trails" : " ^1.0" ,
68
71
"istanbul" : " ^0.4.2" ,
69
72
"mocha" : " ^2.3.4" ,
73
+ "pre-commit" : " ^1.1.3" ,
70
74
"smokesignals" : " ^1.2.0" ,
71
75
"trailpack" : " ^1.0.1" ,
72
76
"winston" : " ^2.1.1"
Original file line number Diff line number Diff line change @@ -214,6 +214,17 @@ describe('Trails', () => {
214
214
215
215
return eventPromise
216
216
} )
217
+ it ( 'should pass event parameters to callbacks added using `onceAny`' , done => {
218
+ const sent = { test : true }
219
+
220
+ app . onceAny ( 'test' , received => {
221
+ assert . equal ( received , sent )
222
+
223
+ return done ( )
224
+ } )
225
+
226
+ app . emit ( 'test' , sent )
227
+ } )
217
228
} )
218
229
} )
219
230
} )
You can’t perform that action at this time.
0 commit comments