We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emit
on
off
上述就是简单的实现啦,实际上我们可以再抽象一下监听器的概念,将所有的 handler 都抽象成一个 listener ,类似于 addEventListener 一样。 实际上到这一步,我们很粗糙的 EventHub 算是完成了,但是我们还可以尽量的优化一下。
下面就是优化后的版本。
如果,觉得图太长了,可以来我的 github 瞧瞧。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
EventHub 基本实现
emit
、on
、off
。上述就是简单的实现啦,实际上我们可以再抽象一下监听器的概念,将所有的 handler 都抽象成一个 listener ,类似于 addEventListener 一样。
实际上到这一步,我们很粗糙的 EventHub 算是完成了,但是我们还可以尽量的优化一下。
下面就是优化后的版本。
如果,觉得图太长了,可以来我的 github 瞧瞧。
The text was updated successfully, but these errors were encountered: