Content-Length: 384224 | pFad | http://github.com/robingenz/capacitor-firebase-performance

B7 GitHub - robingenz/capacitor-firebase-performance: ⚡️ Capacitor plugin for Firebase Performance Monitoring.
Skip to content
This repository has been archived by the owner. It is now read-only.

⚡️ Capacitor plugin for Firebase Performance Monitoring.

License

Notifications You must be signed in to change notification settings

robingenz/capacitor-firebase-performance

Repository files navigation

⚠️ Deprecated repository

This project has been moved to the following monorepo: robingenz/capacitor-firebase.



Firebase Performance

@robingenz/capacitor-firebase-performance

Capacitor plugin for Firebase Performance Monitoring.


Maintainers

Maintainer GitHub Social
Robin Genz robingenz @robin_genz

Installation

npm install @robingenz/capacitor-firebase-performance firebase
npx cap sync

Add Firebase to your project if you haven't already (Android / iOS / Web).

Android

See Add the Performance Monitoring plugin to your app and follow the instructions to set up your app correctly.

Variables

This plugin will use the following project variables (defined in your app’s variables.gradle file):

  • $firebasePerfVersion version of com.google.firebase:firebase-perf (default: 20.0.5)

Configuration

No configuration required for this plugin.

Demo

A working example can be found here: robingenz/capacitor-firebase-plugin-demo

Usage

import { FirebasePerformance } from '@robingenz/capacitor-firebase-performance';

const startTrace = async () => {
  await FirebasePerformance.startTrace({ traceName: 'test_trace' });
};

const stopTrace = async () => {
  await FirebasePerformance.stopTrace({ traceName: 'test_trace' });
};

const incrementMetric = async () => {
  await FirebasePerformance.incrementMetric({ 
    traceName: 'test_trace', 
    metricName: 'item_cache_hit', 
    incrementBy: 1 
  });
};

const setPerformanceCollectionEnabled = async () => {
  await FirebasePerformance.setPerformanceCollectionEnabled({ enabled: true });
};

const isPerformanceCollectionEnabled = async () => {
  const result = await FirebasePerformance.isPerformanceCollectionEnabled();
  return result.enabled;
};

API

startTrace(...)

startTrace(options: StartTraceOptions) => Promise<void>

Starts a trace.

Param Type
options StartTraceOptions

stopTrace(...)

stopTrace(options: StopTraceOptions) => Promise<void>

Stops a trace.

Param Type
options StopTraceOptions

incrementMetric(...)

incrementMetric(options: IncrementMetricOptions) => Promise<void>

Atomically increments the metric with the given name for the selected trace by the incrementBy value.

Param Type
options IncrementMetricOptions

setPerformanceCollectionEnabled(...)

setPerformanceCollectionEnabled(options: SetPerformanceCollectionEnabledOptions) => Promise<void>

Enables or disables performance monitoring. Will be applied with the next start of the app.

Param Type
options SetPerformanceCollectionEnabledOptions

isPerformanceCollectionEnabled()

isPerformanceCollectionEnabled() => Promise<IsPerformanceCollectionEnabledResult>

Determines whether performance monitoring is enabled or disabled.

Returns: Promise<IsPerformanceCollectionEnabledResult>


Interfaces

StartTraceOptions

Prop Type Description
traceName string 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.

StopTraceOptions

Prop Type Description
traceName string Name of the trace that was set with startTrace.

IncrementMetricOptions

Prop Type Description
traceName string Name of the trace that was set with startTrace.
metricName string Name of the metric to be incremented.
incrementBy number Amount by which the metric has to be incremented. Default: 1

SetPerformanceCollectionEnabledOptions

Prop Type Description
enabled boolean Should performance monitoring be enabled.

IsPerformanceCollectionEnabledResult

Prop Type Description
enabled boolean true if performance monitoring is enabled, otherwise false.

Changelog

See CHANGELOG.md.

License

See LICENSE.









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/robingenz/capacitor-firebase-performance

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy