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
Events.mixTo
trigger
define("ModuleA", functioin(){ var ModuleA = function(){}; Events.mixTo(ModuleA); module.exports = ModuleA; }); var a = new ModuleA(); // 触发事件是对象内部逻辑、状态,a 对象不应该拥有 `trigger` 方法。
The text was updated successfully, but these errors were encountered:
mix是为了让非Events派生的对象拥有事件功能。你的例子没看懂…… 如果a对象不应该有events功能的话?那么在module内部var一个Events就好了,不暴露出来。 反倒是Events没有Class的extends等好奇怪,看代码想要继承Events的话,直接mix构造函数的。
Sorry, something went wrong.
我现在都是内部自己 var 并暴露 on 和 off 方法,从来没用过 mixTo 方法。
No branches or pull requests
Events.mixTo
方法不应该将trigger
方法暴露。trigger
方法应该只提供给内部使用。The text was updated successfully, but these errors were encountered: