【发布时间】:2012-10-11 08:29:59
【问题描述】:
我无法解除绑定一个侦听共享发射器之一的侦听器:
// this is emitter. Fire always in a.b.c namespace but with different parameters
$(document).trigger("a.b.c", {
p: 1,
p2: ...
});
// listener 1
$(document).bind("a.b.c", function(e, object) {
if (object.myParam) {
....
}
});
// listener 2
$(document).bind("a.b.c", function(e, object) {
if (object.anotherParam) {
....
}
});
如何解除监听器 2 的绑定,让监听器 1 继续工作?
【问题讨论】:
-
你是怎么遇到这种情况的。你的设计一定有设计缺陷
-
你能解释一下为什么它是缺陷吗?我需要相同的命名空间,但数据不同。
标签: events triggers event-handling jquery