指南
Firebase性能优化教程
使用@capgo/capacitor-firebase-performance
Capacitor插件用于Firebase性能监控
安装
bun add @capgo/capacitor-firebase-performance
bunx cap sync
此插件暴露
startTrace- 开始一个跟踪stopTrace- 停止一个跟踪incrementMetric- 原子性地将给定名称的指标以所选跟踪的值增加incrementBy简体中文setEnabled- 开启或关闭性能监控。该设置将在下次应用启动时生效。
示例用途
startTrace
开始跟踪。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.startTrace({} as StartTraceOptions);
stopTrace
停止跟踪。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.stopTrace({} as StopTraceOptions);
incrementMetric
原子性地将给定名称的指标值在所选跟踪中增加。 incrementBy 值。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.incrementMetric({} as IncrementMetricOptions);
setEnabled
开启或关闭性能监控。该设置将在下次应用启动时生效。
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.setEnabled({} as SetEnabledOptions);
完整参考
- GitHub: https://github.com/Cap-go/capacitor-firebase/tree/main/packages/performance
- 文档:/docs/plugins/firebase-performance/
继续使用 @capgo/capacitor-firebase-performance
如果您正在使用 使用 @capgo/capacitor-firebase-performance 与其它插件进行连接 Capgo 插件目录 Capgo 插件 Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, 添加或更新插件 Ionic 企业插件替代方案 Ionic 企业插件替代方案 __CAPGO_KEEP_0__ 工作流程 Capgo 原生构建 Capgo 原生构建的产品工作流程。