Lebih Cepat ke Konten

Membuka Mulanya

Jendela terminal
bun add @capgo/capacitor-env
bunx cap sync
import { Env } from '@capgo/capacitor-env';

Mengambil nilai variabel lingkungan spesifik berdasarkan kunci.

Metode ini mengambil variabel lingkungan yang telah ditetapkan selama proses pembangunan native. Variabel-variabel tersebut harus dikonfigurasi di proyek native sebelum dapat diakses pada saat runtime.

import { Env } from '@capgo/capacitor-env';
const result = await EnvPlugin.getKey({ key: 'API_URL' });
console.log(result.value); // 'https://api.example.com'

Halaman ini dihasilkan dari plugin’s src/definitions.tsRe-run sinkronisasi ketika API publik berubah secara upstream.