/
githubmirror
/
ionic
Обзор
Документация
Войти
/
githubmirror
/
ionic
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
core/src/utils/native/status-bar.ts
40 строк
893 B
Sean Perkins
feat(modal): remove capacitor 2 support for status bar styles (#29028)
14 фев 2024, 04:29
Не верифицирован
14 фев 2024, 04:29
1fb8ff7
Код
Авторство
О чём код?
import type { StatusBarPlugin, Style as StatusBarStyle } from '@capacitor/status-bar'; import { getCapacitor } from './capacitor'; interface StyleOptions { style: StatusBarStyle; } export enum Style { Dark = 'DARK', Light = 'LIGHT', Default = 'DEFAULT', } export const StatusBar = { getEngine(): StatusBarPlugin | undefined { const capacitor = getCapacitor(); if (capacitor?.isPluginAvailable('StatusBar')) { return capacitor.Plugins.StatusBar as StatusBarPlugin; } return undefined; }, setStyle(options: StyleOptions) { const engine = this.getEngine(); if (!engine) { return; } engine.setStyle(options); }, getStyle: async function (): Promise<StatusBarStyle> { const engine = this.getEngine(); if (!engine) { return Style.Default; } const { style } = await engine.getInfo(); return style; }, };