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

Method _initGlobalObserver

www/js/_hyperscript-max.js:3221–3242  ·  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

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

Callers 1

_subscribeEffectMethod · 0.45

Calls 2

_handleMutationsMethod · 0.45
_handleDOMEventMethod · 0.45

Tested by

no test coverage detected