@capacitor-firebase/performance 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorFirebasePerformance.podspec +19 -0
- package/LICENSE +201 -0
- package/README.md +200 -0
- package/android/build.gradle +60 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/dev/robingenz/capacitorjs/plugins/firebase/performance/FirebasePerformance.java +45 -0
- package/android/src/main/java/dev/robingenz/capacitorjs/plugins/firebase/performance/FirebasePerformancePlugin.java +92 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +194 -0
- package/dist/esm/definitions.d.ts +67 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +10 -0
- package/dist/esm/web.js +41 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +57 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +59 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/FirebasePerformance.swift +46 -0
- package/ios/Plugin/FirebasePerformancePlugin.h +10 -0
- package/ios/Plugin/FirebasePerformancePlugin.m +12 -0
- package/ios/Plugin/FirebasePerformancePlugin.swift +83 -0
- package/ios/Plugin/Info.plist +24 -0
- package/package.json +84 -0
package/dist/docs.json
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "FirebasePerformancePlugin",
|
|
4
|
+
"slug": "firebaseperformanceplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "startTrace",
|
|
10
|
+
"signature": "(options: StartTraceOptions) => Promise<void>",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"name": "options",
|
|
14
|
+
"docs": "",
|
|
15
|
+
"type": "StartTraceOptions"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"returns": "Promise<void>",
|
|
19
|
+
"tags": [],
|
|
20
|
+
"docs": "Starts a trace.",
|
|
21
|
+
"complexTypes": [
|
|
22
|
+
"StartTraceOptions"
|
|
23
|
+
],
|
|
24
|
+
"slug": "starttrace"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "stopTrace",
|
|
28
|
+
"signature": "(options: StopTraceOptions) => Promise<void>",
|
|
29
|
+
"parameters": [
|
|
30
|
+
{
|
|
31
|
+
"name": "options",
|
|
32
|
+
"docs": "",
|
|
33
|
+
"type": "StopTraceOptions"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"returns": "Promise<void>",
|
|
37
|
+
"tags": [],
|
|
38
|
+
"docs": "Stops a trace.",
|
|
39
|
+
"complexTypes": [
|
|
40
|
+
"StopTraceOptions"
|
|
41
|
+
],
|
|
42
|
+
"slug": "stoptrace"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "incrementMetric",
|
|
46
|
+
"signature": "(options: IncrementMetricOptions) => Promise<void>",
|
|
47
|
+
"parameters": [
|
|
48
|
+
{
|
|
49
|
+
"name": "options",
|
|
50
|
+
"docs": "",
|
|
51
|
+
"type": "IncrementMetricOptions"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"returns": "Promise<void>",
|
|
55
|
+
"tags": [],
|
|
56
|
+
"docs": "Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.",
|
|
57
|
+
"complexTypes": [
|
|
58
|
+
"IncrementMetricOptions"
|
|
59
|
+
],
|
|
60
|
+
"slug": "incrementmetric"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "setPerformanceCollectionEnabled",
|
|
64
|
+
"signature": "(options: SetPerformanceCollectionEnabledOptions) => Promise<void>",
|
|
65
|
+
"parameters": [
|
|
66
|
+
{
|
|
67
|
+
"name": "options",
|
|
68
|
+
"docs": "",
|
|
69
|
+
"type": "SetPerformanceCollectionEnabledOptions"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"returns": "Promise<void>",
|
|
73
|
+
"tags": [],
|
|
74
|
+
"docs": "Enables or disables performance monitoring.\nWill be applied with the next start of the app.",
|
|
75
|
+
"complexTypes": [
|
|
76
|
+
"SetPerformanceCollectionEnabledOptions"
|
|
77
|
+
],
|
|
78
|
+
"slug": "setperformancecollectionenabled"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "isPerformanceCollectionEnabled",
|
|
82
|
+
"signature": "() => Promise<IsPerformanceCollectionEnabledResult>",
|
|
83
|
+
"parameters": [],
|
|
84
|
+
"returns": "Promise<IsPerformanceCollectionEnabledResult>",
|
|
85
|
+
"tags": [],
|
|
86
|
+
"docs": "Determines whether performance monitoring is enabled or disabled.",
|
|
87
|
+
"complexTypes": [
|
|
88
|
+
"IsPerformanceCollectionEnabledResult"
|
|
89
|
+
],
|
|
90
|
+
"slug": "isperformancecollectionenabled"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"properties": []
|
|
94
|
+
},
|
|
95
|
+
"interfaces": [
|
|
96
|
+
{
|
|
97
|
+
"name": "StartTraceOptions",
|
|
98
|
+
"slug": "starttraceoptions",
|
|
99
|
+
"docs": "",
|
|
100
|
+
"tags": [],
|
|
101
|
+
"methods": [],
|
|
102
|
+
"properties": [
|
|
103
|
+
{
|
|
104
|
+
"name": "traceName",
|
|
105
|
+
"tags": [],
|
|
106
|
+
"docs": "Custom trace name.\n\nNames for custom code traces must meet the following requirements:\nno leading or trailing whitespace, no leading underscore (_) character,\nand max length is 100 characters.",
|
|
107
|
+
"complexTypes": [],
|
|
108
|
+
"type": "string"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "StopTraceOptions",
|
|
114
|
+
"slug": "stoptraceoptions",
|
|
115
|
+
"docs": "",
|
|
116
|
+
"tags": [],
|
|
117
|
+
"methods": [],
|
|
118
|
+
"properties": [
|
|
119
|
+
{
|
|
120
|
+
"name": "traceName",
|
|
121
|
+
"tags": [],
|
|
122
|
+
"docs": "Name of the trace that was set with `startTrace`.",
|
|
123
|
+
"complexTypes": [],
|
|
124
|
+
"type": "string"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "IncrementMetricOptions",
|
|
130
|
+
"slug": "incrementmetricoptions",
|
|
131
|
+
"docs": "",
|
|
132
|
+
"tags": [],
|
|
133
|
+
"methods": [],
|
|
134
|
+
"properties": [
|
|
135
|
+
{
|
|
136
|
+
"name": "traceName",
|
|
137
|
+
"tags": [],
|
|
138
|
+
"docs": "Name of the trace that was set with `startTrace`.",
|
|
139
|
+
"complexTypes": [],
|
|
140
|
+
"type": "string"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "metricName",
|
|
144
|
+
"tags": [],
|
|
145
|
+
"docs": "Name of the metric to be incremented.",
|
|
146
|
+
"complexTypes": [],
|
|
147
|
+
"type": "string"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "incrementBy",
|
|
151
|
+
"tags": [],
|
|
152
|
+
"docs": "Amount by which the metric has to be incremented.\n\nDefault: `1`",
|
|
153
|
+
"complexTypes": [],
|
|
154
|
+
"type": "number | undefined"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "SetPerformanceCollectionEnabledOptions",
|
|
160
|
+
"slug": "setperformancecollectionenabledoptions",
|
|
161
|
+
"docs": "",
|
|
162
|
+
"tags": [],
|
|
163
|
+
"methods": [],
|
|
164
|
+
"properties": [
|
|
165
|
+
{
|
|
166
|
+
"name": "enabled",
|
|
167
|
+
"tags": [],
|
|
168
|
+
"docs": "Should performance monitoring be enabled.",
|
|
169
|
+
"complexTypes": [],
|
|
170
|
+
"type": "boolean"
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "IsPerformanceCollectionEnabledResult",
|
|
176
|
+
"slug": "isperformancecollectionenabledresult",
|
|
177
|
+
"docs": "",
|
|
178
|
+
"tags": [],
|
|
179
|
+
"methods": [],
|
|
180
|
+
"properties": [
|
|
181
|
+
{
|
|
182
|
+
"name": "enabled",
|
|
183
|
+
"tags": [],
|
|
184
|
+
"docs": "`true` if performance monitoring is enabled, otherwise `false`.",
|
|
185
|
+
"complexTypes": [],
|
|
186
|
+
"type": "boolean"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"enums": [],
|
|
192
|
+
"typeAliases": [],
|
|
193
|
+
"pluginConfigs": []
|
|
194
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface FirebasePerformancePlugin {
|
|
2
|
+
/**
|
|
3
|
+
* Starts a trace.
|
|
4
|
+
*/
|
|
5
|
+
startTrace(options: StartTraceOptions): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Stops a trace.
|
|
8
|
+
*/
|
|
9
|
+
stopTrace(options: StopTraceOptions): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.
|
|
12
|
+
*/
|
|
13
|
+
incrementMetric(options: IncrementMetricOptions): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Enables or disables performance monitoring.
|
|
16
|
+
* Will be applied with the next start of the app.
|
|
17
|
+
*/
|
|
18
|
+
setPerformanceCollectionEnabled(options: SetPerformanceCollectionEnabledOptions): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Determines whether performance monitoring is enabled or disabled.
|
|
21
|
+
*/
|
|
22
|
+
isPerformanceCollectionEnabled(): Promise<IsPerformanceCollectionEnabledResult>;
|
|
23
|
+
}
|
|
24
|
+
export interface StartTraceOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Custom trace name.
|
|
27
|
+
*
|
|
28
|
+
* Names for custom code traces must meet the following requirements:
|
|
29
|
+
* no leading or trailing whitespace, no leading underscore (_) character,
|
|
30
|
+
* and max length is 100 characters.
|
|
31
|
+
*/
|
|
32
|
+
traceName: string;
|
|
33
|
+
}
|
|
34
|
+
export interface StopTraceOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Name of the trace that was set with `startTrace`.
|
|
37
|
+
*/
|
|
38
|
+
traceName: string;
|
|
39
|
+
}
|
|
40
|
+
export interface IncrementMetricOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Name of the trace that was set with `startTrace`.
|
|
43
|
+
*/
|
|
44
|
+
traceName: string;
|
|
45
|
+
/**
|
|
46
|
+
* Name of the metric to be incremented.
|
|
47
|
+
*/
|
|
48
|
+
metricName: string;
|
|
49
|
+
/**
|
|
50
|
+
* Amount by which the metric has to be incremented.
|
|
51
|
+
*
|
|
52
|
+
* Default: `1`
|
|
53
|
+
*/
|
|
54
|
+
incrementBy?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface SetPerformanceCollectionEnabledOptions {
|
|
57
|
+
/**
|
|
58
|
+
* Should performance monitoring be enabled.
|
|
59
|
+
*/
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface IsPerformanceCollectionEnabledResult {
|
|
63
|
+
/**
|
|
64
|
+
* `true` if performance monitoring is enabled, otherwise `false`.
|
|
65
|
+
*/
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface FirebasePerformancePlugin {\n /**\n * Starts a trace.\n */\n startTrace(options: StartTraceOptions): Promise<void>;\n /**\n * Stops a trace.\n */\n stopTrace(options: StopTraceOptions): Promise<void>;\n /**\n * Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.\n */\n incrementMetric(options: IncrementMetricOptions): Promise<void>;\n /**\n * Enables or disables performance monitoring.\n * Will be applied with the next start of the app.\n */\n setPerformanceCollectionEnabled(\n options: SetPerformanceCollectionEnabledOptions,\n ): Promise<void>;\n /**\n * Determines whether performance monitoring is enabled or disabled.\n */\n isPerformanceCollectionEnabled(): Promise<IsPerformanceCollectionEnabledResult>;\n}\n\nexport interface StartTraceOptions {\n /**\n * Custom trace name.\n *\n * Names for custom code traces must meet the following requirements:\n * no leading or trailing whitespace, no leading underscore (_) character,\n * and max length is 100 characters.\n */\n traceName: string;\n}\n\nexport interface StopTraceOptions {\n /**\n * Name of the trace that was set with `startTrace`.\n */\n traceName: string;\n}\n\nexport interface IncrementMetricOptions {\n /**\n * Name of the trace that was set with `startTrace`.\n */\n traceName: string;\n /**\n * Name of the metric to be incremented.\n */\n metricName: string;\n /**\n * Amount by which the metric has to be incremented.\n *\n * Default: `1`\n */\n incrementBy?: number;\n}\n\nexport interface SetPerformanceCollectionEnabledOptions {\n /**\n * Should performance monitoring be enabled.\n */\n enabled: boolean;\n}\n\nexport interface IsPerformanceCollectionEnabledResult {\n /**\n * `true` if performance monitoring is enabled, otherwise `false`.\n */\n enabled: boolean;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const FirebasePerformance = registerPlugin('FirebasePerformance', {
|
|
3
|
+
web: () => import('./web').then(m => new m.FirebasePerformanceWeb()),
|
|
4
|
+
});
|
|
5
|
+
export * from './definitions';
|
|
6
|
+
export { FirebasePerformance };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,mBAAmB,GAAG,cAAc,CACxC,qBAAqB,EACrB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;CACrE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { FirebasePerformancePlugin } from './definitions';\n\nconst FirebasePerformance = registerPlugin<FirebasePerformancePlugin>(\n 'FirebasePerformance',\n {\n web: () => import('./web').then(m => new m.FirebasePerformanceWeb()),\n },\n);\n\nexport * from './definitions';\nexport { FirebasePerformance };\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { FirebasePerformancePlugin, IncrementMetricOptions, IsPerformanceCollectionEnabledResult, SetPerformanceCollectionEnabledOptions, StartTraceOptions, StopTraceOptions } from './definitions';
|
|
3
|
+
export declare class FirebasePerformanceWeb extends WebPlugin implements FirebasePerformancePlugin {
|
|
4
|
+
private traces;
|
|
5
|
+
startTrace(options: StartTraceOptions): Promise<void>;
|
|
6
|
+
stopTrace(options: StopTraceOptions): Promise<void>;
|
|
7
|
+
incrementMetric(options: IncrementMetricOptions): Promise<void>;
|
|
8
|
+
setPerformanceCollectionEnabled(options: SetPerformanceCollectionEnabledOptions): Promise<void>;
|
|
9
|
+
isPerformanceCollectionEnabled(): Promise<IsPerformanceCollectionEnabledResult>;
|
|
10
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import { getPerformance, trace as createTrace } from 'firebase/performance';
|
|
3
|
+
export class FirebasePerformanceWeb extends WebPlugin {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.traces = {};
|
|
7
|
+
}
|
|
8
|
+
async startTrace(options) {
|
|
9
|
+
const perf = getPerformance();
|
|
10
|
+
const trace = createTrace(perf, options.traceName);
|
|
11
|
+
trace.start();
|
|
12
|
+
this.traces[options.traceName] = trace;
|
|
13
|
+
}
|
|
14
|
+
async stopTrace(options) {
|
|
15
|
+
const trace = this.traces[options.traceName];
|
|
16
|
+
if (!trace) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
trace.stop();
|
|
20
|
+
}
|
|
21
|
+
async incrementMetric(options) {
|
|
22
|
+
const trace = this.traces[options.traceName];
|
|
23
|
+
if (!trace) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
trace.incrementMetric(options.metricName, options.incrementBy);
|
|
27
|
+
}
|
|
28
|
+
async setPerformanceCollectionEnabled(options) {
|
|
29
|
+
const perf = getPerformance();
|
|
30
|
+
perf.instrumentationEnabled = options.enabled;
|
|
31
|
+
perf.dataCollectionEnabled = options.enabled;
|
|
32
|
+
}
|
|
33
|
+
async isPerformanceCollectionEnabled() {
|
|
34
|
+
const perf = getPerformance();
|
|
35
|
+
const result = {
|
|
36
|
+
enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,
|
|
37
|
+
};
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAW5E,MAAM,OAAO,sBACX,SAAQ,SAAS;IADnB;;QAGU,WAAM,GAAoD,EAAE,CAAC;IAwCvE,CAAC;IAtCQ,KAAK,CAAC,UAAU,CAAC,OAA0B;QAChD,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACnD,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;IACzC,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,OAAyB;QAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,IAAI,EAAE,CAAC;IACf,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,OAA+B;QAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,+BAA+B,CAC1C,OAA+C;QAE/C,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;QAC9C,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,8BAA8B;QACzC,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAyC;YACnD,OAAO,EAAE,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,qBAAqB;SACnE,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PerformanceTrace } from 'firebase/performance';\nimport { getPerformance, trace as createTrace } from 'firebase/performance';\n\nimport type {\n FirebasePerformancePlugin,\n IncrementMetricOptions,\n IsPerformanceCollectionEnabledResult,\n SetPerformanceCollectionEnabledOptions,\n StartTraceOptions,\n StopTraceOptions,\n} from './definitions';\n\nexport class FirebasePerformanceWeb\n extends WebPlugin\n implements FirebasePerformancePlugin {\n private traces: { [key: string]: PerformanceTrace | undefined } = {};\n\n public async startTrace(options: StartTraceOptions): Promise<void> {\n const perf = getPerformance();\n const trace = createTrace(perf, options.traceName);\n trace.start();\n this.traces[options.traceName] = trace;\n }\n\n public async stopTrace(options: StopTraceOptions): Promise<void> {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.stop();\n }\n\n public async incrementMetric(options: IncrementMetricOptions): Promise<void> {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.incrementMetric(options.metricName, options.incrementBy);\n }\n\n public async setPerformanceCollectionEnabled(\n options: SetPerformanceCollectionEnabledOptions,\n ): Promise<void> {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n\n public async isPerformanceCollectionEnabled(): Promise<IsPerformanceCollectionEnabledResult> {\n const perf = getPerformance();\n const result: IsPerformanceCollectionEnabledResult = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@capacitor/core');
|
|
6
|
+
var performance = require('firebase/performance');
|
|
7
|
+
|
|
8
|
+
const FirebasePerformance = core.registerPlugin('FirebasePerformance', {
|
|
9
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.FirebasePerformanceWeb()),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
class FirebasePerformanceWeb extends core.WebPlugin {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.traces = {};
|
|
16
|
+
}
|
|
17
|
+
async startTrace(options) {
|
|
18
|
+
const perf = performance.getPerformance();
|
|
19
|
+
const trace = performance.trace(perf, options.traceName);
|
|
20
|
+
trace.start();
|
|
21
|
+
this.traces[options.traceName] = trace;
|
|
22
|
+
}
|
|
23
|
+
async stopTrace(options) {
|
|
24
|
+
const trace = this.traces[options.traceName];
|
|
25
|
+
if (!trace) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
trace.stop();
|
|
29
|
+
}
|
|
30
|
+
async incrementMetric(options) {
|
|
31
|
+
const trace = this.traces[options.traceName];
|
|
32
|
+
if (!trace) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
trace.incrementMetric(options.metricName, options.incrementBy);
|
|
36
|
+
}
|
|
37
|
+
async setPerformanceCollectionEnabled(options) {
|
|
38
|
+
const perf = performance.getPerformance();
|
|
39
|
+
perf.instrumentationEnabled = options.enabled;
|
|
40
|
+
perf.dataCollectionEnabled = options.enabled;
|
|
41
|
+
}
|
|
42
|
+
async isPerformanceCollectionEnabled() {
|
|
43
|
+
const perf = performance.getPerformance();
|
|
44
|
+
const result = {
|
|
45
|
+
enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,
|
|
46
|
+
};
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
52
|
+
__proto__: null,
|
|
53
|
+
FirebasePerformanceWeb: FirebasePerformanceWeb
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
exports.FirebasePerformance = FirebasePerformance;
|
|
57
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FirebasePerformance = registerPlugin('FirebasePerformance', {\n web: () => import('./web').then(m => new m.FirebasePerformanceWeb()),\n});\nexport * from './definitions';\nexport { FirebasePerformance };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { getPerformance, trace as createTrace } from 'firebase/performance';\nexport class FirebasePerformanceWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.traces = {};\n }\n async startTrace(options) {\n const perf = getPerformance();\n const trace = createTrace(perf, options.traceName);\n trace.start();\n this.traces[options.traceName] = trace;\n }\n async stopTrace(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.stop();\n }\n async incrementMetric(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.incrementMetric(options.metricName, options.incrementBy);\n }\n async setPerformanceCollectionEnabled(options) {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n async isPerformanceCollectionEnabled() {\n const perf = getPerformance();\n const result = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","getPerformance","createTrace"],"mappings":";;;;;;;AACK,MAAC,mBAAmB,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;AAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;AACxE,CAAC;;ACDM,MAAM,sBAAsB,SAASC,cAAS,CAAC;AACtD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;AAC5B,QAAQ,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;AACzB,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B,QAAQ,MAAM,IAAI,GAAGC,0BAAc,EAAE,CAAC;AACtC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;AAC3D,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;AACtB,QAAQ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;AAC/C,KAAK;AACL,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;AAC7B,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACrD,QAAQ,IAAI,CAAC,KAAK,EAAE;AACpB,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;AACrB,KAAK;AACL,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;AACnC,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACrD,QAAQ,IAAI,CAAC,KAAK,EAAE;AACpB,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;AACvE,KAAK;AACL,IAAI,MAAM,+BAA+B,CAAC,OAAO,EAAE;AACnD,QAAQ,MAAM,IAAI,GAAGD,0BAAc,EAAE,CAAC;AACtC,QAAQ,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;AACtD,QAAQ,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;AACrD,KAAK;AACL,IAAI,MAAM,8BAA8B,GAAG;AAC3C,QAAQ,MAAM,IAAI,GAAGA,0BAAc,EAAE,CAAC;AACtC,QAAQ,MAAM,MAAM,GAAG;AACvB,YAAY,OAAO,EAAE,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,qBAAqB;AAC9E,SAAS,CAAC;AACV,QAAQ,OAAO,MAAM,CAAC;AACtB,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var capacitorFirebasePerformance = (function (exports, core, performance) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const FirebasePerformance = core.registerPlugin('FirebasePerformance', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.FirebasePerformanceWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
class FirebasePerformanceWeb extends core.WebPlugin {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.traces = {};
|
|
12
|
+
}
|
|
13
|
+
async startTrace(options) {
|
|
14
|
+
const perf = performance.getPerformance();
|
|
15
|
+
const trace = performance.trace(perf, options.traceName);
|
|
16
|
+
trace.start();
|
|
17
|
+
this.traces[options.traceName] = trace;
|
|
18
|
+
}
|
|
19
|
+
async stopTrace(options) {
|
|
20
|
+
const trace = this.traces[options.traceName];
|
|
21
|
+
if (!trace) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
trace.stop();
|
|
25
|
+
}
|
|
26
|
+
async incrementMetric(options) {
|
|
27
|
+
const trace = this.traces[options.traceName];
|
|
28
|
+
if (!trace) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
trace.incrementMetric(options.metricName, options.incrementBy);
|
|
32
|
+
}
|
|
33
|
+
async setPerformanceCollectionEnabled(options) {
|
|
34
|
+
const perf = performance.getPerformance();
|
|
35
|
+
perf.instrumentationEnabled = options.enabled;
|
|
36
|
+
perf.dataCollectionEnabled = options.enabled;
|
|
37
|
+
}
|
|
38
|
+
async isPerformanceCollectionEnabled() {
|
|
39
|
+
const perf = performance.getPerformance();
|
|
40
|
+
const result = {
|
|
41
|
+
enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,
|
|
42
|
+
};
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
48
|
+
__proto__: null,
|
|
49
|
+
FirebasePerformanceWeb: FirebasePerformanceWeb
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
exports.FirebasePerformance = FirebasePerformance;
|
|
53
|
+
|
|
54
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
55
|
+
|
|
56
|
+
return exports;
|
|
57
|
+
|
|
58
|
+
}({}, capacitorExports, firebasePerformanceExports));
|
|
59
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FirebasePerformance = registerPlugin('FirebasePerformance', {\n web: () => import('./web').then(m => new m.FirebasePerformanceWeb()),\n});\nexport * from './definitions';\nexport { FirebasePerformance };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { getPerformance, trace as createTrace } from 'firebase/performance';\nexport class FirebasePerformanceWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.traces = {};\n }\n async startTrace(options) {\n const perf = getPerformance();\n const trace = createTrace(perf, options.traceName);\n trace.start();\n this.traces[options.traceName] = trace;\n }\n async stopTrace(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.stop();\n }\n async incrementMetric(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.incrementMetric(options.metricName, options.incrementBy);\n }\n async setPerformanceCollectionEnabled(options) {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n async isPerformanceCollectionEnabled() {\n const perf = getPerformance();\n const result = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","getPerformance","createTrace"],"mappings":";;;AACK,UAAC,mBAAmB,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;IAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;IACxE,CAAC;;ICDM,MAAM,sBAAsB,SAASC,cAAS,CAAC;IACtD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,QAAQ,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACzB,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,MAAM,IAAI,GAAGC,0BAAc,EAAE,CAAC;IACtC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3D,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,QAAQ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;IAC/C,KAAK;IACL,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;IAC7B,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrD,QAAQ,IAAI,CAAC,KAAK,EAAE;IACpB,YAAY,OAAO;IACnB,SAAS;IACT,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,KAAK;IACL,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;IACnC,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrD,QAAQ,IAAI,CAAC,KAAK,EAAE;IACpB,YAAY,OAAO;IACnB,SAAS;IACT,QAAQ,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACvE,KAAK;IACL,IAAI,MAAM,+BAA+B,CAAC,OAAO,EAAE;IACnD,QAAQ,MAAM,IAAI,GAAGD,0BAAc,EAAE,CAAC;IACtC,QAAQ,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;IACtD,QAAQ,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IACrD,KAAK;IACL,IAAI,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,MAAM,IAAI,GAAGA,0BAAc,EAAE,CAAC;IACtC,QAAQ,MAAM,MAAM,GAAG;IACvB,YAAY,OAAO,EAAE,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,qBAAqB;IAC9E,SAAS,CAAC;IACV,QAAQ,OAAO,MAAM,CAAC;IACtB,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
import FirebaseCore
|
|
4
|
+
import FirebasePerformance
|
|
5
|
+
|
|
6
|
+
@objc public class FirebasePerformance: NSObject {
|
|
7
|
+
var traces: [String: Trace] = [:]
|
|
8
|
+
|
|
9
|
+
override init() {
|
|
10
|
+
if FirebaseApp.app() == nil {
|
|
11
|
+
FirebaseApp.configure()
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@objc public func startTrace(_ traceName: String) {
|
|
16
|
+
let trace = Performance.startTrace(name: traceName)
|
|
17
|
+
self.traces[traceName] = trace
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@objc public func stopTrace(_ traceName: String) {
|
|
21
|
+
guard let trace = self.traces[traceName] else {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
trace.stop()
|
|
25
|
+
self.traces.removeValue(forKey: traceName)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@objc public func incrementMetric(_ traceName: String, _ metricName: String, _ incrementBy: Int) {
|
|
29
|
+
guard let trace = self.traces[traceName] else {
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
trace.incrementMetric(metricName, by: Int64(incrementBy))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@objc public func getTraceByName(_ traceName: String) -> Trace? {
|
|
36
|
+
return self.traces[traceName]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@objc public func setPerformanceCollectionEnabled(_ enabled: Bool) {
|
|
40
|
+
Performance.sharedInstance().isDataCollectionEnabled = enabled
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@objc public func isPerformanceCollectionEnabled() -> Bool {
|
|
44
|
+
return Performance.sharedInstance().isDataCollectionEnabled
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
//! Project version number for Plugin.
|
|
4
|
+
FOUNDATION_EXPORT double PluginVersionNumber;
|
|
5
|
+
|
|
6
|
+
//! Project version string for Plugin.
|
|
7
|
+
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
|
8
|
+
|
|
9
|
+
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
|
10
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <Capacitor/Capacitor.h>
|
|
3
|
+
|
|
4
|
+
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
|
+
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
|
+
CAP_PLUGIN(FirebasePerformancePlugin, "FirebasePerformance",
|
|
7
|
+
CAP_PLUGIN_METHOD(startTrace, CAPPluginReturnPromise);
|
|
8
|
+
CAP_PLUGIN_METHOD(stopTrace, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(incrementMetric, CAPPluginReturnPromise);
|
|
10
|
+
CAP_PLUGIN_METHOD(setPerformanceCollectionEnabled, CAPPluginReturnPromise);
|
|
11
|
+
CAP_PLUGIN_METHOD(isPerformanceCollectionEnabled, CAPPluginReturnPromise);
|
|
12
|
+
)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Please read the Capacitor iOS Plugin Development Guide
|
|
6
|
+
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
|
+
*/
|
|
8
|
+
@objc(FirebasePerformancePlugin)
|
|
9
|
+
public class FirebasePerformancePlugin: CAPPlugin {
|
|
10
|
+
public let errorTraceNameMissing = "traceName must be provided."
|
|
11
|
+
public let errorMetricNameMissing = "metricName must be provided."
|
|
12
|
+
public let errorEnabledMissing = "enabled must be provided."
|
|
13
|
+
public let errorTraceNameAlreadyAssigned = "traceName already assigned."
|
|
14
|
+
public let errorTraceNotFound = "No trace was found with the provided traceName."
|
|
15
|
+
private var implementation: FirebasePerformance?
|
|
16
|
+
|
|
17
|
+
override public func load() {
|
|
18
|
+
implementation = FirebasePerformance()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@objc func startTrace(_ call: CAPPluginCall) {
|
|
22
|
+
guard let traceName = call.getString("traceName") else {
|
|
23
|
+
call.reject(errorTraceNameMissing)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
let trace = implementation?.getTraceByName(traceName)
|
|
27
|
+
guard trace == nil else {
|
|
28
|
+
call.reject(errorTraceNameAlreadyAssigned)
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
implementation?.startTrace(traceName)
|
|
32
|
+
call.resolve()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@objc func stopTrace(_ call: CAPPluginCall) {
|
|
36
|
+
guard let traceName = call.getString("traceName") else {
|
|
37
|
+
call.reject(errorTraceNameMissing)
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
let trace = implementation?.getTraceByName(traceName)
|
|
41
|
+
guard trace != nil else {
|
|
42
|
+
call.reject(errorTraceNotFound)
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
implementation?.stopTrace(traceName)
|
|
46
|
+
call.resolve()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@objc func incrementMetric(_ call: CAPPluginCall) {
|
|
50
|
+
guard let traceName = call.getString("traceName") else {
|
|
51
|
+
call.reject(errorTraceNameMissing)
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
guard let metricName = call.getString("metricName") else {
|
|
55
|
+
call.reject(errorMetricNameMissing)
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
let trace = implementation?.getTraceByName(traceName)
|
|
59
|
+
guard trace != nil else {
|
|
60
|
+
call.reject(errorTraceNotFound)
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
let incrementBy = call.getInt("incrementBy") ?? 1
|
|
64
|
+
implementation?.incrementMetric(traceName, metricName, incrementBy)
|
|
65
|
+
call.resolve()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@objc func setPerformanceCollectionEnabled(_ call: CAPPluginCall) {
|
|
69
|
+
guard let enabled = call.getBool("enabled") else {
|
|
70
|
+
call.reject(errorEnabledMissing)
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
implementation?.setPerformanceCollectionEnabled(enabled)
|
|
74
|
+
call.resolve()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@objc func isPerformanceCollectionEnabled(_ call: CAPPluginCall) {
|
|
78
|
+
let enabled = implementation?.isPerformanceCollectionEnabled()
|
|
79
|
+
var result = JSObject()
|
|
80
|
+
result["enabled"] = enabled
|
|
81
|
+
call.resolve(result)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
+
<string>6.0</string>
|
|
13
|
+
<key>CFBundleName</key>
|
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
|
15
|
+
<key>CFBundlePackageType</key>
|
|
16
|
+
<string>FMWK</string>
|
|
17
|
+
<key>CFBundleShortVersionString</key>
|
|
18
|
+
<string>1.0</string>
|
|
19
|
+
<key>CFBundleVersion</key>
|
|
20
|
+
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
+
<key>NSPrincipalClass</key>
|
|
22
|
+
<string></string>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|