开发者

javascript event bus architecture

开发者 https://www.devze.com 2023-03-23 01:39 出处:网络
In this video at 20:50 (corresponding slide), Nicholas Zakas presents what I think is an Event Bus architecture. What I don\'t know is whether the calls that interact with the Bus should be asynchrono

In this video at 20:50 (corresponding slide), Nicholas Zakas presents what I think is an Event Bus architecture. What I don't know is whether the calls that interact with the Bus should be asynchronous or not?

The second question: if the calls are asynchronous, how should 开发者_如何学编程they be implemented?

Thank you


I believe they are asynchronous indeed.

My guess is that way they seem to be implemented is by using custom DOM events.

This is a useful technique for decoupling in javascript and you can check jQuery's trigger docs, look for the 'custom' string to see how to fire a custom event.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号