Sha256: 38c3c9be0bdbc3c0f51ba0f5a212ec2e05a2db0df702a724f2f11dfcb12965ca

Contents?: true

Size: 419 Bytes

Versions: 1

Compression:

Stored size: 419 Bytes

Contents

module PouchDB
  class EventEmitter
    include Conversion

    def initialize(stream)
      @native    = stream
    end

    def on(event, &blk)
      %x{
        #{@native}.on(event, function(change) {
          #{blk.call(OBJECT_CONVERSION.call(`change`))}
        })
      }

      self
    end

    def then
      as_opal_promise(`#{@native}`)
    end

    def cancel
      `#{@native}.cancel()`
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-pouchdb-0.1.1 opal/pouchdb/event_emitter.rb