MCPcopy Create free account
hub / github.com/Nynxz/ComfyUI-IdeogramHelper / instanceWatch

Function instanceWatch

web/main.js:2298–2312  ·  view source on GitHub ↗
(source, value, options)

Source from the content-addressed store, hash-verified

2296 return watchHandle;
2297}
2298function instanceWatch(source, value, options) {
2299 const publicThis = this.proxy;
2300 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
2301 let cb;
2302 if (isFunction(value)) {
2303 cb = value;
2304 } else {
2305 cb = value.handler;
2306 options = value;
2307 }
2308 const reset = setCurrentInstance(this);
2309 const res = doWatch(getter, cb.bind(publicThis), options);
2310 reset();
2311 return res;
2312}
2313function createPathGetter(ctx, path) {
2314 const segments = path.split(".");
2315 return () => {

Callers

nothing calls this directly

Calls 5

isStringFunction · 0.85
createPathGetterFunction · 0.85
isFunctionFunction · 0.85
setCurrentInstanceFunction · 0.85
doWatchFunction · 0.85

Tested by

no test coverage detected