MCPcopy
hub / github.com/QwikDev/qwik / track

Function track

packages/qwik/src/core/use/use-task.ts:567–587  ·  view source on GitHub ↗
(obj: (() => unknown) | object | Signal, prop?: string)

Source from the content-addressed store, hash-verified

565 );
566
567 const track: Tracker = (obj: (() => unknown) | object | Signal, prop?: string) => {
568 if (isFunction(obj)) {
569 const ctx = newInvokeContext();
570 ctx.$renderCtx$ = rCtx;
571 ctx.$subscriber$ = [0, task];
572 return invoke(ctx, obj);
573 }
574 const manager = getSubscriptionManager(obj);
575 if (manager) {
576 manager.$addSub$([0, task], prop);
577 } else {
578 logErrorAndStop(codeToText(QError_trackUseStore), obj);
579 }
580 if (prop) {
581 return (obj as Record<string, unknown>)[prop];
582 } else if (isSignal(obj)) {
583 return obj.value;
584 } else {
585 return obj;
586 }
587 };
588 const resourceTarget = unwrapProxy(resource);
589 const opts: ResourceCtx<T> = {
590 track,

Callers 15

index.tsxFile · 0.85
index.tsxFile · 0.85
examples.tsxFile · 0.85
use-task.unit.tsFile · 0.85
runFunction · 0.85
link-component.tsxFile · 0.85
runFunction · 0.85
qwikifyQrlFunction · 0.85
useTrapFocusFunction · 0.85

Calls 8

isFunctionFunction · 0.90
newInvokeContextFunction · 0.90
invokeFunction · 0.90
getSubscriptionManagerFunction · 0.90
logErrorAndStopFunction · 0.90
codeToTextFunction · 0.90
isSignalFunction · 0.90
$addSub$Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…