- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我看到这些事件散布在 chaplin 示例代码中,但在文档或源代码中没有任何解释。似乎这意味着它是一个全局事件,触发了一个 Action 。那是对的吗?它们只是一个惯例,还是以某种方式强制执行?
# Handle login
@subscribeEvent 'logout', @logout
@subscribeEvent 'userData', @userData
# Handler events which trigger an action
# Show the login dialog
@subscribeEvent '!showLogin', @showLoginView
# Try to login with a service provider
@subscribeEvent '!login', @triggerLogin
# Initiate logout
@subscribeEvent '!logout', @triggerLogout
最佳答案
引自GitHub issue regarding the same question :
!logout
is more a inter-module message or command. It allows one module to trigger the logout (for example a view with a logout button). The actual logout process is then handled by another module (for example the session controller). This module invalidates the session on the server, for example. When successful, it emits alogout
event which means thelogout
has happened. All modules which are interested in login/logout should subscribe tologout
.
我认为这解释得很好。基本上 !
事件在 Action 开始时触发,普通事件在 Action 成功时触发。
关于javascript - 在 Chaplin js 框架中,以 ! 为前缀的事件是做什么的?意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15008754/
我正在为自己构建一个测试应用程序,以了解有关 coffeescript、Backbone、Brunch.io 和 Chaplin JS 的更多信息,但我被卡住了,无法弄清楚自己做错了什么。 这是我在
我目前正在构思一个大型单页 Web 应用程序。会有很多组件,所以关注点分离对我来说很重要。服务器基本上是一个带有一些糖的 REST 服务器,比如向客户端发送模板代码。 所以我需要决定我想在客户端使用哪
我看到这些事件散布在 chaplin 示例代码中,但在文档或源代码中没有任何解释。似乎这意味着它是一个全局事件,触发了一个 Action 。那是对的吗?它们只是一个惯例,还是以某种方式强制执行? #
将 Chaplin 与 Browserify 和 jQuery 结合使用需要您执行以下操作: Backbone = require('backbone') $ = require('jquery')
我是一名优秀的程序员,十分优秀!