rubycdp / ferrum

Headless Chrome Ruby API
https://ferrum.rubycdp.com
MIT License
1.68k stars 119 forks source link

Allow subscriptions to be removed #455

Open rzane opened 3 months ago

rzane commented 3 months ago

This is admittedly not the most elegant API, but my goal is to start a discussion about how this should look.

Here's how you'd subscribe and unsubscribe:

subscription = page.on("Some.event") do |params, _index, _total|
  # etc
end

page.off("Some.event", subscription)

Here are some important considerations: