UNPKG

@tanstack/angular-query-experimental

Version:

Signals for managing, caching and syncing asynchronous and remote data in Angular

1 lines 1.29 kB
{"version":3,"file":"pending-tasks-compat.mjs","sources":["../src/pending-tasks-compat.ts"],"sourcesContent":["import { InjectionToken, inject } from '@angular/core'\nimport * as ng from '@angular/core'\nimport { noop } from '@tanstack/query-core'\n\ntype PendingTasksCompat = { add: () => PendingTaskRef }\n\nexport type PendingTaskRef = () => void\n\nexport const PENDING_TASKS = new InjectionToken<PendingTasksCompat>(\n 'PENDING_TASKS',\n {\n factory: (): PendingTasksCompat => {\n // Access via Reflect so bundlers stay quiet when the token is absent (Angular < 19).\n const token = Reflect.get(ng, 'PendingTasks') as unknown as\n | Parameters<typeof inject>[0]\n | undefined\n\n const svc: PendingTasksCompat | null = token\n ? (inject(token, { optional: true }) as PendingTasksCompat | null)\n : null\n\n // Without PendingTasks we fall back to a stable no-op shim.\n return {\n add: svc ? () => svc.add() : () => noop,\n }\n },\n },\n)\n"],"names":[],"mappings":";;;AAQO,MAAM,gBAAgB,IAAI;AAAA,EAC/B;AAAA,EACA;AAAA,IACE,SAAS,MAA0B;AAEjC,YAAM,QAAQ,QAAQ,IAAI,IAAI,cAAc;AAItC,YAAA,MAAiC,QAClC,OAAO,OAAO,EAAE,UAAU,KAAM,CAAA,IACjC;AAGG,aAAA;AAAA,QACL,KAAK,MAAM,MAAM,IAAI,QAAQ,MAAM;AAAA,MACrC;AAAA,IAAA;AAAA,EACF;AAEJ;"}