方法
- A
- B
- O
实例公共方法
after_subscribe(*methods, &block) 链接
当调用了 Base#subscribed 方法后,此回调将被触发,即使订阅被 Base#reject 方法拒绝了。
要仅在成功订阅时触发回调,请使用 Base#subscription_rejected? 方法。
after_subscribe :my_method, unless: :subscription_rejected?
也别名作为: on_subscribe
源码: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/channel/callbacks.rb, line 60 def after_subscribe(*methods, &block) set_callback(:subscribe, :after, *methods, &block) end
after_unsubscribe(*methods, &block) 链接
也别名作为: on_unsubscribe
源码: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/channel/callbacks.rb, line 69 def after_unsubscribe(*methods, &block) set_callback(:unsubscribe, :after, *methods, &block) end
before_subscribe(*methods, &block) 链接
源码: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/channel/callbacks.rb, line 48 def before_subscribe(*methods, &block) set_callback(:subscribe, :before, *methods, &block) end
before_unsubscribe(*methods, &block) 链接
源码: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/channel/callbacks.rb, line 65 def before_unsubscribe(*methods, &block) set_callback(:unsubscribe, :before, *methods, &block) end