Empezar
Copie un prompt de configuración con los pasos de instalación y la guía de markdown completa para este plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-firebase-performance`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/firebase-performance/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Instalar
Sección titulada “Instalar”bun add @capgo/capacitor-firebase-performancebunx cap syncImportar
Sección titulada “Importar”import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';API Resumen
Sección titulada “API Resumen”startTrace
Sección titulada “startTrace”Inicia un seguimiento.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.startTrace({} as StartTraceOptions);stopTrace
Sección titulada “stopTrace”Detiene un seguimiento.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.stopTrace({} as StopTraceOptions);incrementMetric
Sección titulada “incrementMetric”Incrementa de manera atómica el métrica con el nombre dado para el seguimiento seleccionado por el incrementBy valor.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.incrementMetric({} as IncrementMetricOptions);setEnabled
Sección titulada “setEnabled”Habilita o deshabilita el monitoreo de rendimiento. Se aplicará con el próximo arranque de la aplicación.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.setEnabled({} as SetEnabledOptions);isEnabled
Sección titulada “isEnabled”Determina si el monitoreo de rendimiento está habilitado o deshabilitado.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.isEnabled();putAttribute
Sección titulada “putAttribute”Establece un atributo personalizado de un seguimiento a un valor dado.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.putAttribute({} as PutAttributeOptions);getAttribute
Sección titulada “getAttribute”Devuelve el valor de un atributo personalizado de un seguimiento.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.getAttribute({} as GetAttributeOptions);getAttributes
Sección titulada “getAttributes”Obtiene todos los atributos personalizados de un seguimiento con sus valores.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.getAttributes({} as GetAttributesOptions);removeAttribute
Sección titulada “removeAttribute”Elimina un atributo personalizado de un seguimiento dado su nombre.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.removeAttribute({} as RemoveAttributeOptions);putMetric
Sección titulada “putMetric”Establece el valor de un métrica personalizada.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.putMetric({} as PutMetricOptions);getMetric
Sección titulada “getMetric”Obtiene el valor de una métrica personalizada por nombre.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.getMetric({} as GetMetricOptions);Registra un seguimiento dado su nombre y opciones.
Solo disponible en web.
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.record({} as RecordOptions);Referencia de tipos
Sección titulada “Referencia de tipos”StartTraceOptions
Sección titulada “Opciones de StartTrace”export interface StartTraceOptions { /** * Custom trace name. * * Names for custom code traces must meet the following requirements: * no leading or trailing whitespace, no leading underscore (_) character, * and max length is 100 characters. * * @since 0.1.0 */ traceName: string;}StopTraceOptions
Sección titulada “Opciones de StopTrace”export interface StopTraceOptions { /** * Name of the trace that was set with `startTrace`. * * @since 0.1.0 */ traceName: string;}IncrementMetricOptions
Sección titulada “Opciones de Incrementar métrica”export interface IncrementMetricOptions { /** * Name of the trace that was set with `startTrace`. * * @since 0.1.0 */ traceName: string; /** * Name of the metric to be incremented. * * @since 0.1.0 */ metricName: string; /** * Amount by which the metric has to be incremented. * * @default 1 * @since 0.1.0 */ incrementBy?: number;}SetEnabledOptions
Sección titulada “Opciones de Habilitar”export interface SetEnabledOptions { /** * Should performance monitoring be enabled. * * @since 0.1.0 */ enabled: boolean;}IsEnabledResult
Sección titulada “Resultado de IsEnabled”export interface IsEnabledResult { /** * `true` if performance monitoring is enabled, otherwise `false`. * * @since 0.1.0 */ enabled: boolean;}PutAttributeOptions
Sección titulada “PutAttributeOptions”export interface PutAttributeOptions { /** * Name of the trace to set its attribute. * * @since 6.3.0 */ traceName: string; /** * Name of the attribute to set its value. * * @since 6.3.0 * @example "experiment" */ attribute: string; /** * The value to set to the attribute. * * @since 6.3.0 * @example "A" */ value: string;}GetAttributeOptions
Sección titulada “GetAttributeOptions”export interface GetAttributeOptions { /** * Name of the trace to set its attribute. * * @since 6.3.0 */ traceName: string; /** * Name of the attribute to retrieve its value. * * @since 6.3.0 */ attribute: string;}GetAttributeResult
Sección titulada “GetAttributeResult”export interface GetAttributeResult { /** * The value of the custom attribute. * * @since 6.3.0 */ value: string | null;}GetAttributesOptions
Sección titulada “GetAttributesOptions”export interface GetAttributesOptions { /** * Name of the trace to get its attributes. * * @since 6.3.0 */ traceName: string;}GetAttributesResult
Sección titulada “GetAttributesResult”export interface GetAttributesResult { /** * A map of all custom attributes of a trace with their values. * * @since 6.3.0 */ attributes: { [key: string]: string };}RemoveAttributeOptions
Sección titulada “RemoveAttributeOptions”export type RemoveAttributeOptions = GetAttributeOptions;PutMetricOptions
Sección titulada “PutMetricOptions”export interface PutMetricOptions { /** * Name of the trace to set its metric. * * @since 6.3.0 */ traceName: string; /** * The metric name. * * @since 6.3.0 */ metricName: string; /** * The value to set for the metric. * The given value is floored down to the nearest integer. * * @since 6.3.0 */ num: number;}Fuente de Verdad
Sección titulada “Fuente de Verdad”Esta página se genera a partir del plugin’s src/definitions.tsRe-ruta la sincronización cuando el público API cambie en la fuente.