@capacitor-firebase/performance 0.5.1-dev.01021f0.1659726888 → 1.0.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 -19
- package/LICENSE +201 -201
- package/README.md +76 -76
- package/android/build.gradle +59 -59
- package/android/src/main/AndroidManifest.xml +3 -3
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/performance/FirebasePerformance.java +45 -45
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/performance/FirebasePerformancePlugin.java +112 -112
- package/dist/docs.json +2 -2
- package/dist/esm/definitions.d.ts +102 -102
- package/dist/esm/definitions.js +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +6 -6
- package/dist/esm/web.d.ts +10 -10
- package/dist/esm/web.js +40 -40
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +39 -39
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +39 -39
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/FirebasePerformance.swift +46 -46
- package/ios/Plugin/FirebasePerformancePlugin.h +10 -10
- package/ios/Plugin/FirebasePerformancePlugin.m +12 -12
- package/ios/Plugin/FirebasePerformancePlugin.swift +83 -83
- package/ios/Plugin/Info.plist +24 -24
- package/package.json +95 -95
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface FirebasePerformancePlugin {\
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface FirebasePerformancePlugin {\n /**\n * Starts a trace.\n *\n * @since 0.1.0\n */\n startTrace(options: StartTraceOptions): Promise<void>;\n /**\n * Stops a trace.\n *\n * @since 0.1.0\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 * @since 0.1.0\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 * @since 0.1.0\n */\n setEnabled(options: SetEnabledOptions): Promise<void>;\n /**\n * Determines whether performance monitoring is enabled or disabled.\n *\n * @since 0.1.0\n */\n isEnabled(): Promise<IsEnabledResult>;\n}\n\n/**\n * @since 0.1.0\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 * @since 0.1.0\n */\n traceName: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface StopTraceOptions {\n /**\n * Name of the trace that was set with `startTrace`.\n *\n * @since 0.1.0\n */\n traceName: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface IncrementMetricOptions {\n /**\n * Name of the trace that was set with `startTrace`.\n *\n * @since 0.1.0\n */\n traceName: string;\n /**\n * Name of the metric to be incremented.\n *\n * @since 0.1.0\n */\n metricName: string;\n /**\n * Amount by which the metric has to be incremented.\n *\n * @default 1\n * @since 0.1.0\n */\n incrementBy?: number;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface SetEnabledOptions {\n /**\n * Should performance monitoring be enabled.\n *\n * @since 0.1.0\n */\n enabled: boolean;\n}\n\nexport interface IsEnabledResult {\n /**\n * `true` if performance monitoring is enabled, otherwise `false`.\n *\n * @since 0.1.0\n */\n enabled: boolean;\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FirebasePerformancePlugin } from './definitions';
|
|
2
|
-
declare const FirebasePerformance: FirebasePerformancePlugin;
|
|
3
|
-
export * from './definitions';
|
|
4
|
-
export { FirebasePerformance };
|
|
1
|
+
import type { FirebasePerformancePlugin } from './definitions';
|
|
2
|
+
declare const FirebasePerformance: FirebasePerformancePlugin;
|
|
3
|
+
export * from './definitions';
|
|
4
|
+
export { FirebasePerformance };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +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 };
|
|
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
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { FirebasePerformancePlugin, IncrementMetricOptions, IsEnabledResult, SetEnabledOptions, 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
|
-
setEnabled(options: SetEnabledOptions): Promise<void>;
|
|
9
|
-
isEnabled(): Promise<IsEnabledResult>;
|
|
10
|
-
}
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { FirebasePerformancePlugin, IncrementMetricOptions, IsEnabledResult, SetEnabledOptions, 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
|
+
setEnabled(options: SetEnabledOptions): Promise<void>;
|
|
9
|
+
isEnabled(): Promise<IsEnabledResult>;
|
|
10
|
+
}
|
package/dist/esm/web.js
CHANGED
|
@@ -1,41 +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 setEnabled(options) {
|
|
29
|
-
const perf = getPerformance();
|
|
30
|
-
perf.instrumentationEnabled = options.enabled;
|
|
31
|
-
perf.dataCollectionEnabled = options.enabled;
|
|
32
|
-
}
|
|
33
|
-
async isEnabled() {
|
|
34
|
-
const perf = getPerformance();
|
|
35
|
-
const result = {
|
|
36
|
-
enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,
|
|
37
|
-
};
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
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 setEnabled(options) {
|
|
29
|
+
const perf = getPerformance();
|
|
30
|
+
perf.instrumentationEnabled = options.enabled;
|
|
31
|
+
perf.dataCollectionEnabled = options.enabled;
|
|
32
|
+
}
|
|
33
|
+
async isEnabled() {
|
|
34
|
+
const perf = getPerformance();
|
|
35
|
+
const result = {
|
|
36
|
+
enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,
|
|
37
|
+
};
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
41
|
//# sourceMappingURL=web.js.map
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +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,KA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,CAAC,qBAAqB;SACnE,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\
|
|
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;;QAIU,WAAM,GAAoD,EAAE,CAAC;IAsCvE,CAAC;IApCQ,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,UAAU,CAAC,OAA0B;QAChD,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,SAAS;QACpB,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAoB;YAC9B,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 IsEnabledResult,\n SetEnabledOptions,\n StartTraceOptions,\n StopTraceOptions,\n} from './definitions';\n\nexport class FirebasePerformanceWeb\n extends WebPlugin\n implements FirebasePerformancePlugin\n{\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 setEnabled(options: SetEnabledOptions): Promise<void> {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n\n public async isEnabled(): Promise<IsEnabledResult> {\n const perf = getPerformance();\n const result: IsEnabledResult = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -5,47 +5,47 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var core = require('@capacitor/core');
|
|
6
6
|
var performance = require('firebase/performance');
|
|
7
7
|
|
|
8
|
-
const FirebasePerformance = core.registerPlugin('FirebasePerformance', {
|
|
9
|
-
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.FirebasePerformanceWeb()),
|
|
8
|
+
const FirebasePerformance = core.registerPlugin('FirebasePerformance', {
|
|
9
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.FirebasePerformanceWeb()),
|
|
10
10
|
});
|
|
11
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 setEnabled(options) {
|
|
38
|
-
const perf = performance.getPerformance();
|
|
39
|
-
perf.instrumentationEnabled = options.enabled;
|
|
40
|
-
perf.dataCollectionEnabled = options.enabled;
|
|
41
|
-
}
|
|
42
|
-
async isEnabled() {
|
|
43
|
-
const perf = performance.getPerformance();
|
|
44
|
-
const result = {
|
|
45
|
-
enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,
|
|
46
|
-
};
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
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 setEnabled(options) {
|
|
38
|
+
const perf = performance.getPerformance();
|
|
39
|
+
perf.instrumentationEnabled = options.enabled;
|
|
40
|
+
perf.dataCollectionEnabled = options.enabled;
|
|
41
|
+
}
|
|
42
|
+
async isEnabled() {
|
|
43
|
+
const perf = performance.getPerformance();
|
|
44
|
+
const result = {
|
|
45
|
+
enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,
|
|
46
|
+
};
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\
|
|
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 setEnabled(options) {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n async isEnabled() {\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;AA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|
var capacitorFirebasePerformance = (function (exports, core, performance) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const FirebasePerformance = core.registerPlugin('FirebasePerformance', {
|
|
5
|
-
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.FirebasePerformanceWeb()),
|
|
4
|
+
const FirebasePerformance = core.registerPlugin('FirebasePerformance', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.FirebasePerformanceWeb()),
|
|
6
6
|
});
|
|
7
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 setEnabled(options) {
|
|
34
|
-
const perf = performance.getPerformance();
|
|
35
|
-
perf.instrumentationEnabled = options.enabled;
|
|
36
|
-
perf.dataCollectionEnabled = options.enabled;
|
|
37
|
-
}
|
|
38
|
-
async isEnabled() {
|
|
39
|
-
const perf = performance.getPerformance();
|
|
40
|
-
const result = {
|
|
41
|
-
enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,
|
|
42
|
-
};
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
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 setEnabled(options) {
|
|
34
|
+
const perf = performance.getPerformance();
|
|
35
|
+
perf.instrumentationEnabled = options.enabled;
|
|
36
|
+
perf.dataCollectionEnabled = options.enabled;
|
|
37
|
+
}
|
|
38
|
+
async isEnabled() {
|
|
39
|
+
const perf = performance.getPerformance();
|
|
40
|
+
const result = {
|
|
41
|
+
enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,
|
|
42
|
+
};
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\
|
|
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 setEnabled(options) {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n async isEnabled() {\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,CA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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 setEnabled(_ enabled: Bool) {
|
|
40
|
-
Performance.sharedInstance().isDataCollectionEnabled = enabled
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@objc public func isEnabled() -> Bool {
|
|
44
|
-
return Performance.sharedInstance().isDataCollectionEnabled
|
|
45
|
-
}
|
|
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 setEnabled(_ enabled: Bool) {
|
|
40
|
+
Performance.sharedInstance().isDataCollectionEnabled = enabled
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@objc public func isEnabled() -> Bool {
|
|
44
|
+
return Performance.sharedInstance().isDataCollectionEnabled
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,10 +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
|
-
|
|
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
|
+
|
|
@@ -1,12 +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(setEnabled, CAPPluginReturnPromise);
|
|
11
|
-
CAP_PLUGIN_METHOD(isEnabled, CAPPluginReturnPromise);
|
|
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(setEnabled, CAPPluginReturnPromise);
|
|
11
|
+
CAP_PLUGIN_METHOD(isEnabled, CAPPluginReturnPromise);
|
|
12
|
+
)
|