Class: Puppeteer::Page::ScreenshotTaskQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/puppeteer/page/screenshot_task_queue.rb

Instance Method Summary collapse

Constructor Details

#initializeScreenshotTaskQueue

Returns a new instance of ScreenshotTaskQueue.



3
4
5
# File 'lib/puppeteer/page/screenshot_task_queue.rb', line 3

def initialize
  @chain = Concurrent::Promises.fulfilled_future(nil)
end

Instance Method Details

#post_task(&block) ⇒ Object



7
8
9
10
11
# File 'lib/puppeteer/page/screenshot_task_queue.rb', line 7

def post_task(&block)
  result = @chain.then { block.call }
  @chain = result.rescue { nil }
  result.value!
end