Class: Puppeteer::Page::ScreenshotTaskQueue
- Inherits:
-
Object
- Object
- Puppeteer::Page::ScreenshotTaskQueue
- Defined in:
- lib/puppeteer/page/screenshot_task_queue.rb
Instance Method Summary collapse
-
#initialize ⇒ ScreenshotTaskQueue
constructor
A new instance of ScreenshotTaskQueue.
- #post_task(&block) ⇒ Object
Constructor Details
#initialize ⇒ ScreenshotTaskQueue
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 |