【发布时间】:2014-07-16 13:40:17
【问题描述】:
我目前有一个 jQuery 函数,我用它来跟踪当前页面是否像这样被聚焦..
$(window).on("blur focus", (e) ->
prevType = $(this).data("prevType")
if prevType != e.type
if e.type == "blur"
...
else if e.type == "focus"
...
$(this).data("prevType", e.type)
)
我想将此代码从原始 jQuery 移到 Template.template.events 哈希中,但不确定如何执行,或者是否可能?
【问题讨论】: