MCPcopy Create free account
hub / github.com/TanStack/db / subscribeChanges

Method subscribeChanges

packages/db/src/collection/index.ts:936–943  ·  view source on GitHub ↗

* Subscribe to changes in the collection * @param callback - Function called when items change * @param options - Subscription options including includeInitialState and where filter * @returns Unsubscribe function - Call this to stop listening for changes * @example * // Basic subscri

(
    callback: (
      changes: Array<ChangeMessage<WithVirtualProps<TOutput, TKey>>>,
    ) => void,
    options: SubscribeChangesOptions<TOutput, TKey> = {},
  )

Source from the content-addressed store, hash-verified

934 * })
935 */
936 public subscribeChanges(
937 callback: (
938 changes: Array<ChangeMessage<WithVirtualProps<TOutput, TKey>>>,
939 ) => void,
940 options: SubscribeChangesOptions<TOutput, TKey> = {},
941 ): CollectionSubscription {
942 return this._changes.subscribeChanges(callback, options)
943 }
944
945 /**
946 * Subscribe to a collection event

Callers 15

useLiveQueryFunction · 0.45
useLiveQueryFunction · 0.45
query.test.tsFile · 0.45
rxdb.test.tsFile · 0.45
useLiveQueryFunction · 0.45
powersync.test.tsFile · 0.45
injectLiveQueryFunction · 0.45
startMethod · 0.45

Calls

no outgoing calls

Tested by 1

recordBatchesFunction · 0.36