UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

1 lines • 1.07 kB
{"version":3,"file":"pooled-source.cjs","names":[],"sources":["../../../src/query/pooled-source.ts"],"sourcesContent":["import type { CollectionImpl } from '../collection/index.js'\n\n// A pooled view's source Collection. A view registers here when it is\n// created, so the live-query observer finds the source without bundling\n// pooling into apps that never import `pooledLiveQueries`.\nconst pooledSources = new WeakMap<\n object,\n CollectionImpl<any, any, any, any, any>\n>()\n\nexport function registerPooledSource(\n view: object,\n source: CollectionImpl<any, any, any, any, any>,\n): void {\n pooledSources.set(view, source)\n}\n\nexport function getPooledLiveQuerySource(\n value: unknown,\n): CollectionImpl<any, any, any, any, any> | undefined {\n return typeof value === `object` && value !== null\n ? pooledSources.get(value)\n : undefined\n}\n"],"mappings":"AAKA,IAAM,gCAAgB,IAAI,QAGxB;AAEF,SAAgB,qBACd,MACA,QACM;CACN,cAAc,IAAI,MAAM,MAAM;AAChC;AAEA,SAAgB,yBACd,OACqD;CACrD,OAAO,OAAO,UAAU,YAAY,UAAU,OAC1C,cAAc,IAAI,KAAK,IACvB,KAAA;AACN"}