Method: Browser::Blob#text
- Defined in:
- opal/browser/blob.rb
#text(&block) ⇒ Object
Convert a blob to a UTF-8 encoded string.
If block is given it will be called with a parameter once we receive the text. Otherwise return a Promise which will resolve once we receive it.
29 30 31 32 33 34 35 36 37 |
# File 'opal/browser/blob.rb', line 29 def text(&block) promise = nil unless block_given? promise = Promise.new block = proc { |i| promise.resolve(i) } end `#@native.text().then(#{block.to_n})` promise end |