javascript - Meteor - collection find after global keydown? -
i have searched on , meteor not seem able these 2 things @ same time.
what want simple: when button pressed (globally), collection.find(...) called. not doable in template.events since meteor not support global keydown's, , can't in template.rendered because, reason, collection.find return nothing.
any ideas?
the following works, requires element in page have focus, guess problem in case.
ui.body.events({ 'keydown': function(event, template){ console.log('a key down!') } })
i guess have without meteor. following should work in modern browsers:
function keydownlistener(event){ console.log('a key down!') } template.templatename.created = function(){ document.body.addeventlistener('keydown', keydownlistener) } template.templatename.destroyed = function(){ document.body.removeeventlistener('keydown', keydownlistener) }
Comments
Post a Comment