I'm (still!) pretty new to Spine, and I'm attempting to create a listener on an element in my view, and I have had no success (judging by both behavior of the app and by looking in the developer's console for the attached event listeners on the appropriate element.
Spine= require 'spine'
Design= require 'models/design'
class Designs extends Spine.Controller
# className: 'designs'
constructor: ()->
super
console.log 'my element: '+@el[0].toString()
events:
'change input.users-design': 'new_design'
new_design: (event) ->
event.preventDefault()
console.log 'event triggered'
module.exports= Designs
my view:
div#canvas_div
div#file-chooser
input(type='file',name='design_file',class='users-design')
p.
some text so we know it has loaded using Spine version #{version}.
canvas#design
I would expect that the event listed in the controller Designs would listen for a change event on the input.users_design element in my view (which, as a file chooser, appears to work fine-- I click on the button, and am presented with a file chooser dialogue, which fills in the field when I select a file-- I am assuming this selection should trigger the change event in this element). When I walk through the setup in the debugger in the console, the code triggered by the 'events:' section to Designs appears to add an event listener (at least it calls addEventListener()!).
Clearly I'm missing something fundamental here. If I've left out any pertinent information, please let me know and I'll try to add it.
Thanks!