UNPKG

expo-health-kit

Version:

A comprehensive TypeScript library for React Native and Expo that enables exporting Apple HealthKit data

33 lines 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExpoHealthKit = void 0; const expo_modules_core_1 = require("expo-modules-core"); const ExpoHealthKitModule = expo_modules_core_1.NativeModulesProxy.ExpoHealthKit; class ExpoHealthKit { constructor() { this.config = null; } async configure(config) { this.config = config; } async isHealthKitAvailable() { return await ExpoHealthKitModule.isHealthKitAvailable(); } async requestAuthorization(dataTypes) { if (!dataTypes.length) { throw new Error('At least one data type must be specified'); } return await ExpoHealthKitModule.requestAuthorization(dataTypes); } async exportData(options) { if (!this.config) { throw new Error('ExpoHealthKit must be configured before exporting data'); } return await ExpoHealthKitModule.exportHealthData(options); } async queryHealthData(dataType, startDate, endDate, options) { return await ExpoHealthKitModule.queryHealthData(dataType, startDate.toISOString(), endDate.toISOString(), options); } } exports.ExpoHealthKit = ExpoHealthKit; //# sourceMappingURL=index.js.map