var o = {}
_.extend(o, Backbone.Events)
o.on('custom', function(){ console.log("A nested event was triggered!"); })
o.trigger('custom:nested', otherDataThatINeed);backbone中是否有内置的功能,如嵌套事件所示?以前有人实现过这样的功能吗?(Google搜索绝对不返回任何内容)
发布于 2014-04-10 02:58:25
事件名称仅仅是标签,它们没有层次结构。
您可能希望向事件添加选项,并添加一些逻辑以在调用事件时处理这些选项。
o.trigger('custom', {'secondevent': 'nestedeventname', 'somedata': otherDataThatINeed});https://stackoverflow.com/questions/22971533
复制相似问题