내용으로 건너뛰기

시작하기

설치

설치
터미널 창
bun add @capgo/capacitor-barometer
bunx cap sync

import

import
import { CapacitorBarometer } from '@capgo/capacitor-barometer';

최근 바오메트로 측정값을 캡처한 네이티브 레이어에서 가져옵니다.

import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.getMeasurement();

현재 장치에 바오메트로 센서가 있는지 확인합니다.

import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.isAvailable();

바오메트로 업데이트 스트리밍을 자바스크립트 레이어로 시작합니다.

Call with the measurement 업데이트를 받기 위한 이벤트.

import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.startMeasurementUpdates();

stopMeasurementUpdates

측정 업데이트 중단 섹션

측정 업데이트 시작한 것을 중단하세요.

import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.stopMeasurementUpdates();

checkPermissions

권한 확인 섹션

바로미터 데이터에 대한 현재 권한 상태를 반환합니다.

import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.checkPermissions();

바로미터 데이터에 대한 권한 요청이 플랫폼에 의해 필요할 경우 권한을 요청합니다.

import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.requestPermissions();

타입 참조

타입 참조

GetMeasurementResult

측정 결과 가져오기

__CAPGO_KEEP_0__

export type GetMeasurementResult = Measurement;

__CAPGO_KEEP_0__

export interface IsAvailableResult {
/**
* Indicates whether the device exposes a barometer sensor.
*
* @since 1.0.0
*/
isAvailable: boolean;
}

PermissionStatus

권한 상태

권한 정보

export interface PermissionStatus {
/**
* The permission state for accessing barometer measurements on the current platform.
*
* @since 1.0.0
*/
barometer: BarometerPermissionState;
}

MeasurementEvent

측정 이벤트

__CAPGO_KEEP_0__

export type MeasurementEvent = Measurement;

Measurement

측정 섹션

장치 бар로미터에서 압력 및 상대 고도 값을 샘플링합니다.

export interface Measurement {
/**
* The static air pressure in hectopascals (hPa).
*
* @since 1.0.0
*/
pressure: number;
/**
* The change in altitude relative to the time updates started.
* Only available on iOS; Android will always return `0`.
*
* @since 1.0.0
*/
relativeAltitude: number;
/**
* The timestamp of the measurement in milliseconds since the Unix epoch.
*
* @since 1.0.0
*/
timestamp: number;
}

BarometerPermissionState

바로미터 권한 상태 섹션

센서 접근을 제한할 수 있는 플랫폼을 위한 권한 상태 union limited 클립보드 복사

export type BarometerPermissionState = PermissionState | 'limited';

Platform permission states supported by Capacitor.

export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';

barometerPermissionState

실제 데이터의 원천

이 페이지는 플러그인의 src/definitions.ts. upstream에서 public API이 변경되었을 때 다시 싱크를 실행하세요.