- From: Lea Verou <notifications@github.com>
- Date: Fri, 26 Apr 2024 18:17:02 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 27 April 2024 01:17:06 UTC
### What problem are you trying to solve? Calling `mutationObserver.disconnect()` while forgetting to handle any pending records is a common footgun. ### What solutions exist today? Having to write boilerplate like: ```js let records = mutationObserver.takeRecords(); if (records.length > 0) { callback(records); } mutationObserver.disconnect(); ``` Every time you want to stop observing is quite repetitive, and it cannot be done with just a reference to the mutation observer, since it requires a reference to its callback too. ### How would you solve it? Add a dictionary argument to `disconnect()` with a `flush` option (name TBB) that does exactly this. ### Anything else? _No response_ -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1283 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1283@github.com>
Received on Saturday, 27 April 2024 01:17:06 UTC