MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / _initGlobalObserver

Method _initGlobalObserver

www/js/_hyperscript.esm.js:3220–3241  ·  view source on GitHub ↗

* Set up the single global MutationObserver and delegated input/change * listeners that power attribute, property, and query tracking.

()

Source from the content-addressed store, hash-verified

3218 * listeners that power attribute, property, and query tracking.
3219 */
3220 _initGlobalObserver() {
3221 if (typeof document === "undefined") return;
3222 if (!this._observer) {
3223 var reactivity2 = this;
3224 this._observer = new MutationObserver(function(mutations) {
3225 reactivity2._handleMutations(mutations);
3226 });
3227 this._inputHandler = function(e) {
3228 reactivity2._handleDOMEvent(e);
3229 };
3230 this._changeHandler = function(e) {
3231 reactivity2._handleDOMEvent(e);
3232 };
3233 }
3234 this._observer.observe(document, {
3235 attributes: true,
3236 childList: true,
3237 subtree: true
3238 });
3239 document.addEventListener("input", this._inputHandler, true);
3240 document.addEventListener("change", this._changeHandler, true);
3241 }
3242 /**
3243 * Handle MutationObserver callbacks. Dispatches to attribute and query
3244 * subscriptions based on mutation type.

Callers 1

_subscribeEffectMethod · 0.45

Calls 2

_handleMutationsMethod · 0.45
_handleDOMEventMethod · 0.45

Tested by

no test coverage detected