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

Method _initGlobalObserver

www/js/_hyperscript.js:3222–3243  ·  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

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

Callers 1

_subscribeEffectMethod · 0.45

Calls 2

_handleMutationsMethod · 0.45
_handleDOMEventMethod · 0.45

Tested by

no test coverage detected