rubycdp / ferrum

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

Allow subscriptions to be removed #455

Open rzane opened 8 months ago

rzane commented 8 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: