Meteor JS: How should I bind events to the window in Meteor?
问题 I am trying to detect a mouseup outside of a window in Meteor. I tried this, but window doesn't seem to work: Template.layout.events({ 'mouseup window' : function(e) { console.log("mouseup"); } }); How should I bind events to the window in Meteor? 回答1: The code snippet below will bind the event handler when your template is created and unbind when your template is destroyed. Should give you the behavior you're looking for. var layoutMouseUpHandler = function(e) { console.log('window.mouseup')