Sha256: d673a4852ba0514b4287cc10a7ea0978c9500b4f0da4039f0ba2a73f5a7a38f9
Contents?: true
Size: 780 Bytes
Versions: 4
Compression:
Stored size: 780 Bytes
Contents
module Phoenix class Channel include Native def initialize(topic, params, this) super(`new Phoenix.Channel(#{topic}, #{params.to_n}, #{this})`) end def on(msg, &block) `#{@native}.on(#{msg}, #{callback(block)})` end def push(msg, payload) Push.new `#{@native}.push(#{msg}, #{payload.to_n})` end def join Push.new `#{@native}.join()` end def leave Push.new `#{@native}.leave()` end def joined? `#{@native}.joinedOnce` end def on_error(&block) `#{@native}.onError(#{callback(block)})` end def on_close(&block) `#{@native}.onClose(#{callback(block)})` end def callback(block) proc do |e| block.call(Native(e)) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
opal-phoenix-0.0.6 | opal/phoenix/channel.rb |
opal-phoenix-0.0.5 | opal/phoenix/channel.rb |
opal-phoenix-0.0.4 | opal/phoenix/channel.rb |
opal-phoenix-0.0.3 | opal/phoenix/channel.rb |