方法
- 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