Permalink
Browse files

Merge pull request #298 from snichme/master

Make functions defined in events: {} to be called in correct context
  • Loading branch information...
2 parents b809c99 + 16c557b commit 5e0ff36ee36588602f7f9c68ab583a9e5f817867 @maccman maccman committed May 8, 2012
Showing with 13 additions and 2 deletions.
  1. +8 −1 lib/spine.js
  2. +5 −1 src/spine.coffee
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -425,9 +425,13 @@ class Controller extends Module
delegateEvents: (events) ->
for key, method of events
- unless typeof(method) is 'function'
+ if typeof(method) is 'function'
# Always return true from event handlers
method = do (method) => =>
+ method.apply(this, arguments)
+ true
+ else
+ method = do (method) => =>
@[method].apply(this, arguments)
true

0 comments on commit 5e0ff36

Please sign in to comment.