__CAPGO_KEEP_3__

Getting Started

GitHub

AIアシスタントセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。

ターミナル画面
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

コンテキスト: Capgo マーケティング ウェブサイト。役割: UI ラベル。表示: ページエージェント/[slug].astro。メッセージキー `agents_page_copy_label` (エージェント ページ コピー ラベル)。

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-performance` plugin in my project.

次に、以下のプロンプトを使用してください。

ターミナル画面
bun add @capgo/capacitor-firebase-performance
npx cap sync
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';

クイックスタート

クイックスタート
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.startTrace({ traceName: 'trace' });

例: stopTrace

例: stopTrace
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.stopTrace({ traceName: 'trace' });

例: incrementMetric

例: incrementMetric
import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.incrementMetric({
traceName: 'trace',
metricName: 'metric',
});

よくある間違い

よくある間違い
  • ネイティブ同期:実行 npx cap sync プラグインアップグレード後
  • 真実の源:信頼 src/definitions.ts GitHubの概要

APIの概要

APIガイド

クリップボードにコピー

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.startTrace({ traceName: 'trace' });

停止を実行します。

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.stopTrace({ traceName: 'trace' });

incrementMetric

「incrementMetric」

与えられた名前のメトリックを選択したトレースで、指定された値で incrementBy 「setEnabled」

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.incrementMetric({
traceName: 'trace',
metricName: 'metric',
});

「isEnabled」

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.setEnabled({ enabled: true });

「value」

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
const result = await FirebasePerformance.isEnabled();
console.log(result);

putAttribute

putAttribute

traceにカスタム属性を指定した値に設定します。

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.putAttribute({
traceName: 'trace',
attribute: "experiment",
value: "A",
});

getAttribute

getAttribute

traceのカスタム属性の値を取得します。

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
const result = await FirebasePerformance.getAttribute({
traceName: 'trace',
attribute: 'attribute',
});
console.log(result);

getAttributes

「getAttributes」

traceのすべてのカスタム属性と値を取得します。

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
const result = await FirebasePerformance.getAttributes({ traceName: 'trace' });
console.log(result);

removeAttribute

removeAttribute

traceから指定した名前のカスタム属性を削除します。

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.removeAttribute({
traceName: 'trace',
attribute: 'attribute',
});

カスタムメトリックの値を設定します。

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.putMetric({
traceName: 'trace',
metricName: 'metric',
num: 1,
});

指定された名前のカスタムメトリックの値を取得します。

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
const result = await FirebasePerformance.getMetric({
traceName: 'trace',
metricName: 'metric',
});
console.log(result);

指定された名前とオプションでトレースを記録します。

ウェブ上のみ利用可能です。

import { FirebasePerformance } from '@capgo/capacitor-firebase-performance';
await FirebasePerformance.record({
traceName: 'trace',
startTime: 10,
duration: 1000,
});

StartTraceOptions

StartTraceOptions
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;
}
export interface StopTraceOptions {
/**
* Name of the trace that was set with `startTrace`.
*
* @since 0.1.0
*/
traceName: string;
}

IncrementMetricOptions

StopTraceOptions
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

IncrementMetricOptions
export interface SetEnabledOptions {
/**
* Should performance monitoring be enabled.
*
* @since 0.1.0
*/
enabled: boolean;
}

IsEnabledResult

SetEnabledOptions
export interface IsEnabledResult {
/**
* `true` if performance monitoring is enabled, otherwise `false`.
*
* @since 0.1.0
*/
enabled: boolean;
}

PutAttributeOptions

IsEnabledResult
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

「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

「GetAttributeResult」
export interface GetAttributeResult {
/**
* The value of the custom attribute.
*
* @since 6.3.0
*/
value: string | null;
}

GetAttributesOptions

「GetAttributesOptions」
export interface GetAttributesOptions {
/**
* Name of the trace to get its attributes.
*
* @since 6.3.0
*/
traceName: string;
}

GetAttributesResult

「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

RemoveAttributeOptions
export type RemoveAttributeOptions = GetAttributeOptions;
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;
}

真実の源

「真実の源」

このページはプラグインの src/definitions.ts公開されたAPIがアップストリームで変更されたときに再度同期してください。

「始めから始める」

「始めから始める」

あなたが 「始めから始める」 を使用してダッシュボードとAPIの実行を計画している場合、APIの概要と接続してください。 APIの概要 APIの概要 Introduction 導入の詳細については、Introduction を参照してください。 API キー 導入の詳細については、API キーを参照してください。 デバイス デバイスの実装詳細について 導入の詳細についてはデバイス、 バンドル