Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Blah
- constructor:()->
- @test = "Hello!"
- bindy:()->
- $(window).bind 'some_event',@_myHandler
- _myHandler:()->
- // "this" is NOT the scope you would expect. "this" refers to the event object
- // this will complain that test is undefined
- alert @test
- class Blah2
- bindy:()->
- ths = this
- @_myHandler = ()->
- // this will work correctly
- alert ths.test
- $(window).bind 'some_event',@_myHandler
Add Comment
Please, Sign In to add comment