Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Emit should set the object in question as the context.

  • Loading branch information...
commit f6a43076705085669d7be7a01987904e23822cce 1 parent e8e0a95
@airportyh authored
Showing with 2 additions and 1 deletion.
  1. +1 −1  index.js
  2. +1 −0  tests.js
View
2  index.js
@@ -174,7 +174,7 @@ function emit(obj, evt){
handlers = handlers[evt] || []
for (var i = 0; i < handlers.length; i++){
var callback = handlers[i]
- callback.apply(null, args)
+ callback.apply(obj, args)
}
}
View
1  tests.js
@@ -23,6 +23,7 @@ function worksWith(Object){
t.assert(oncall.called, 'how come you didnt call?')
t.equal(oncall.callCount, 1)
t.deepEqual(oncall.lastCall.args, [1, 'hello'])
+ t.equal(oncall.lastCall.context, obj)
t.end()
})
Please sign in to comment.
Something went wrong with that request. Please try again.