Hype MutationObserver

This extension called Hype MutationObserver, is a wrapper to MutationObserver. It allows to observer elements and act upon changes on their attributes, childlist and subtree. This Hype specific wrapper takes care to register and unregister the observer. It also helps in keeping the callback mutation events scene specific and offers an update rate feature.

Code repository on GitHub

Online Example:
HypeMutationObserver.html

Example Hype File:
HypeMutationObserver.hype.zip

Version-History:
1.0 Initial release under MIT
1.1 Added support for Updaterate

Content Delivery Network (CDN)

Latest version can be linked into your project using the following in the head section of your project:

<script src="https://cdn.jsdelivr.net/gh/worldoptimizer/HypeMutationObserver/HypeMutationObserver.min.js"></script>

Optionally you can also link a SRI version or specific releases.
Read more about that on the JsDelivr (CDN) page for this extension at https://www.jsdelivr.com/package/gh/worldoptimizer/HypeMutationObserver

Learn how to use the latest extension version and how to combine extensions into one file at

2 Likes

I get an error with the download:
URL /Hype/MutationObserver/HypeMutationObserver.zip was not found on this server

Thanks.

Is fixed. Your welcome.

1 Like

↑ look at project
1.1 Added support for Updaterate

Use updaterate on the config object to set it up.
If you use the new updaterate feature to limit the amount of triggers on your mutation code, the extension also takes care to apply the first inital update and the last update. If you don’t want that you can disable them using the config keys disableInitialUpdate and disableFinalUpdate

Visual explanation of updaterate:

PS: As seen on the right hand side of the visualization, the check against the updaterate is not always on the heartbeat of the interval. That is rather what Hype AnimationFrame is for. So if a mutation event falls inbetween to heartbeats (interval) and more time has passed then an interval, it gets fired. That also always sets up a delayed timeout callback to fire any cached mutations in the next interval as a final update.

Here is an example based on Hype MutationObserver:

Here is another project using Hype MutationObserver:

1 Like