Class: Dommy::ReadableStreamDefaultReader

Inherits:
Object
  • Object
show all
Defined in:
lib/dommy/streams.rb

Overview

Reader returned by ‘getReader()`.

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ ReadableStreamDefaultReader

Returns a new instance of ReadableStreamDefaultReader.



175
176
177
# File 'lib/dommy/streams.rb', line 175

def initialize(stream)
  @stream = stream
end

Instance Method Details

#__js_call__(method, args) ⇒ Object



195
196
197
198
199
200
201
202
203
204
# File 'lib/dommy/streams.rb', line 195

def __js_call__(method, args)
  case method
  when "read"
    read
  when "releaseLock"
    release_lock
  when "cancel"
    cancel(args[0])
  end
end

#cancel(reason = nil) ⇒ Object



191
192
193
# File 'lib/dommy/streams.rb', line 191

def cancel(reason = nil)
  @stream.cancel(reason)
end

#readObject



179
180
181
# File 'lib/dommy/streams.rb', line 179

def read
  @stream.__read__
end

#release_lockObject Also known as: releaseLock



183
184
185
186
187
# File 'lib/dommy/streams.rb', line 183

def release_lock
  # Spec: detaches the reader. We model the stream's `@reader`
  # slot indirectly via `releaseLock` accessibility.
  nil
end