@kingstinct/react-native-healthkit
Version:
React Native bindings for HealthKit
15 lines (12 loc) • 429 B
text/typescript
import { Core } from '../modules'
import type { SampleTypeIdentifier } from '../types/Shared'
import type { OnChangeCallbackArgs } from '../types/Subscriptions'
export const subscribeToChanges = (
identifier: SampleTypeIdentifier,
callback: (args: OnChangeCallbackArgs) => void,
) => {
const queryId = Core.subscribeToObserverQuery(identifier, callback)
return {
remove: () => Core.unsubscribeQuery(queryId),
}
}