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 是一个可以被mix到任意对象的模块,它拥有让对象绑定和触发自定义事件的能力。 事件在被绑定之前是不需要事先声明的,还可以携带参数。
Events
自定义事件
看下面的例子:
var object = Chassis.mixin({}, Chassis.Events); object.bind("alert", function(msg) { alert("Triggered " + msg); }); object.trigger("alert", "hi,Chassis!");
事件还提供了几种非常有用的API,详细的使用方法可以参考文档API。
在Chassis的里,事件无处不在,Model、View(PageView、SubView、GlobalView)、Router、History等都自动继承了Events的各种方法,比如,Model的属性被变更时会触发change事件,PageView切换时会触发onBeforePageIn/onAfterPageIn事件。
Model
View
Router
History
change
onBeforePageIn
onAfterPageIn
The text was updated successfully, but these errors were encountered:
No branches or pull requests
<<返回目录
Events
是一个可以被mix到任意对象的模块,它拥有让对象绑定和触发自定义事件
的能力。 事件在被绑定之前是不需要事先声明的,还可以携带参数。看下面的例子:
事件还提供了几种非常有用的API,详细的使用方法可以参考文档API。
在Chassis的里,事件无处不在,
Model
、View
(PageView、SubView、GlobalView)、Router
、History
等都自动继承了Events的各种方法,比如,Model的属性被变更时会触发change
事件,PageView切换时会触发onBeforePageIn
/onAfterPageIn
事件。<<返回目录
The text was updated successfully, but these errors were encountered: