捕获所有事件除了在复位 [英] Catch all events except in reset
本文介绍了捕获所有事件除了在复位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想赶上除了复位的所有事件。我有一个code这样的一个视图中进行初始化。
I wanna catch all events except 'reset'. I've a code like this initialized inside a View.
messagesCollection.on 'all', @_handleMessageChanges, @
现在,它适用于所有事件。正如我上面提到的,我不需要在复位事件捕捉。
Right now it works for all events. As I've mentioned above I don't need to catch in a reset event.
我怎样才能解决这个问题?请帮助我们。
How can I resolve this issue? Please help us.
推荐答案
在使用所有
,第一个参数是事件
。所以,你可以做
When using all
, the first argument is the event
. So, you can do
_handleMessageChanges: function(event, ...) {
if ( event === 'reset' ) return;
}
看到它在这里的行动: http://jsfiddle.net/nxs9q/1
从文档:
全 - 这个特殊事件触发任何触发事件,传递
事件名称作为第一个参数。
"all" — this special event fires for any triggered event, passing the event name as the first argument.
这篇关于捕获所有事件除了在复位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文