@capacitor-firebase/performance 0.5.0 → 0.5.1-dev.bd42e0a.1659614749
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 +0 -2
- package/android/build.gradle +59 -60
- package/android/src/main/AndroidManifest.xml +3 -3
- package/android/src/main/java/dev/robingenz/capacitorjs/plugins/firebase/performance/FirebasePerformancePlugin.java +69 -49
- package/dist/esm/definitions.d.ts +102 -102
- package/dist/esm/definitions.js +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 +40 -40
- 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
|
@@ -19,74 +19,94 @@ public class FirebasePerformancePlugin extends Plugin {
|
|
|
19
19
|
|
|
20
20
|
@PluginMethod
|
|
21
21
|
public void startTrace(PluginCall call) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
try {
|
|
23
|
+
String traceName = call.getString("traceName");
|
|
24
|
+
if (traceName == null) {
|
|
25
|
+
call.reject(ERROR_TRACE_NAME_MISSING);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
Trace trace = implementation.getTraceByName(traceName);
|
|
29
|
+
if (trace != null) {
|
|
30
|
+
call.reject(ERROR_TRACE_NAME_ALREADY_ASSIGNED);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
implementation.startTrace(traceName);
|
|
34
|
+
call.resolve();
|
|
35
|
+
} catch (Exception ex) {
|
|
36
|
+
call.reject(ex.getLocalizedMessage());
|
|
26
37
|
}
|
|
27
|
-
Trace trace = implementation.getTraceByName(traceName);
|
|
28
|
-
if (trace != null) {
|
|
29
|
-
call.reject(ERROR_TRACE_NAME_ALREADY_ASSIGNED);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
implementation.startTrace(traceName);
|
|
33
|
-
call.resolve();
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
@PluginMethod
|
|
37
41
|
public void stopTrace(PluginCall call) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
try {
|
|
43
|
+
String traceName = call.getString("traceName");
|
|
44
|
+
if (traceName == null) {
|
|
45
|
+
call.reject(ERROR_TRACE_NAME_MISSING);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
Trace trace = implementation.getTraceByName(traceName);
|
|
49
|
+
if (trace == null) {
|
|
50
|
+
call.reject(ERROR_TRACE_NOT_FOUND);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
implementation.stopTrace(traceName);
|
|
54
|
+
call.resolve();
|
|
55
|
+
} catch (Exception ex) {
|
|
56
|
+
call.reject(ex.getLocalizedMessage());
|
|
47
57
|
}
|
|
48
|
-
implementation.stopTrace(traceName);
|
|
49
|
-
call.resolve();
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
@PluginMethod
|
|
53
61
|
public void incrementMetric(PluginCall call) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
try {
|
|
63
|
+
String traceName = call.getString("traceName");
|
|
64
|
+
String metricName = call.getString("metricName");
|
|
65
|
+
Integer incrementBy = call.getInt("incrementBy", 1);
|
|
66
|
+
if (traceName == null) {
|
|
67
|
+
call.reject(ERROR_TRACE_NAME_MISSING);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (metricName == null) {
|
|
71
|
+
call.reject(ERROR_METRIC_NAME_MISSING);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
Trace trace = implementation.getTraceByName(traceName);
|
|
75
|
+
if (trace == null) {
|
|
76
|
+
call.reject(ERROR_TRACE_NOT_FOUND);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
implementation.incrementMetric(traceName, metricName, incrementBy);
|
|
80
|
+
call.resolve();
|
|
81
|
+
} catch (Exception ex) {
|
|
82
|
+
call.reject(ex.getLocalizedMessage());
|
|
64
83
|
}
|
|
65
|
-
Trace trace = implementation.getTraceByName(traceName);
|
|
66
|
-
if (trace == null) {
|
|
67
|
-
call.reject(ERROR_TRACE_NOT_FOUND);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
implementation.incrementMetric(traceName, metricName, incrementBy);
|
|
71
|
-
call.resolve();
|
|
72
84
|
}
|
|
73
85
|
|
|
74
86
|
@PluginMethod
|
|
75
87
|
public void setPerformanceCollectionEnabled(PluginCall call) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
try {
|
|
89
|
+
Boolean enabled = call.getBoolean("enabled");
|
|
90
|
+
if (enabled == null) {
|
|
91
|
+
call.reject(ERROR_ENABLED_MISSING);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
implementation.setPerformanceCollectionEnabled(enabled);
|
|
95
|
+
call.resolve();
|
|
96
|
+
} catch (Exception ex) {
|
|
97
|
+
call.reject(ex.getLocalizedMessage());
|
|
80
98
|
}
|
|
81
|
-
implementation.setPerformanceCollectionEnabled(enabled);
|
|
82
|
-
call.resolve();
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
@PluginMethod
|
|
86
102
|
public void isPerformanceCollectionEnabled(PluginCall call) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
try {
|
|
104
|
+
Boolean enabled = implementation.isPerformanceCollectionEnabled();
|
|
105
|
+
JSObject result = new JSObject();
|
|
106
|
+
result.put("enabled", enabled);
|
|
107
|
+
call.resolve(result);
|
|
108
|
+
} catch (Exception ex) {
|
|
109
|
+
call.reject(ex.getLocalizedMessage());
|
|
110
|
+
}
|
|
91
111
|
}
|
|
92
112
|
}
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
export interface FirebasePerformancePlugin {
|
|
2
|
-
/**
|
|
3
|
-
* Starts a trace.
|
|
4
|
-
*
|
|
5
|
-
* @since 0.1.0
|
|
6
|
-
*/
|
|
7
|
-
startTrace(options: StartTraceOptions): Promise<void>;
|
|
8
|
-
/**
|
|
9
|
-
* Stops a trace.
|
|
10
|
-
*
|
|
11
|
-
* @since 0.1.0
|
|
12
|
-
*/
|
|
13
|
-
stopTrace(options: StopTraceOptions): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.
|
|
16
|
-
*
|
|
17
|
-
* @since 0.1.0
|
|
18
|
-
*/
|
|
19
|
-
incrementMetric(options: IncrementMetricOptions): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Enables or disables performance monitoring.
|
|
22
|
-
* Will be applied with the next start of the app.
|
|
23
|
-
*
|
|
24
|
-
* @since 0.1.0
|
|
25
|
-
*/
|
|
26
|
-
setPerformanceCollectionEnabled(options: SetPerformanceCollectionEnabledOptions): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Determines whether performance monitoring is enabled or disabled.
|
|
29
|
-
*
|
|
30
|
-
* @since 0.1.0
|
|
31
|
-
*/
|
|
32
|
-
isPerformanceCollectionEnabled(): Promise<IsPerformanceCollectionEnabledResult>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @since 0.1.0
|
|
36
|
-
*/
|
|
37
|
-
export interface StartTraceOptions {
|
|
38
|
-
/**
|
|
39
|
-
* Custom trace name.
|
|
40
|
-
*
|
|
41
|
-
* Names for custom code traces must meet the following requirements:
|
|
42
|
-
* no leading or trailing whitespace, no leading underscore (_) character,
|
|
43
|
-
* and max length is 100 characters.
|
|
44
|
-
*
|
|
45
|
-
* @since 0.1.0
|
|
46
|
-
*/
|
|
47
|
-
traceName: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* @since 0.1.0
|
|
51
|
-
*/
|
|
52
|
-
export interface StopTraceOptions {
|
|
53
|
-
/**
|
|
54
|
-
* Name of the trace that was set with `startTrace`.
|
|
55
|
-
*
|
|
56
|
-
* @since 0.1.0
|
|
57
|
-
*/
|
|
58
|
-
traceName: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @since 0.1.0
|
|
62
|
-
*/
|
|
63
|
-
export interface IncrementMetricOptions {
|
|
64
|
-
/**
|
|
65
|
-
* Name of the trace that was set with `startTrace`.
|
|
66
|
-
*
|
|
67
|
-
* @since 0.1.0
|
|
68
|
-
*/
|
|
69
|
-
traceName: string;
|
|
70
|
-
/**
|
|
71
|
-
* Name of the metric to be incremented.
|
|
72
|
-
*
|
|
73
|
-
* @since 0.1.0
|
|
74
|
-
*/
|
|
75
|
-
metricName: string;
|
|
76
|
-
/**
|
|
77
|
-
* Amount by which the metric has to be incremented.
|
|
78
|
-
*
|
|
79
|
-
* @default 1
|
|
80
|
-
* @since 0.1.0
|
|
81
|
-
*/
|
|
82
|
-
incrementBy?: number;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* @since 0.1.0
|
|
86
|
-
*/
|
|
87
|
-
export interface SetPerformanceCollectionEnabledOptions {
|
|
88
|
-
/**
|
|
89
|
-
* Should performance monitoring be enabled.
|
|
90
|
-
*
|
|
91
|
-
* @since 0.1.0
|
|
92
|
-
*/
|
|
93
|
-
enabled: boolean;
|
|
94
|
-
}
|
|
95
|
-
export interface IsPerformanceCollectionEnabledResult {
|
|
96
|
-
/**
|
|
97
|
-
* `true` if performance monitoring is enabled, otherwise `false`.
|
|
98
|
-
*
|
|
99
|
-
* @since 0.1.0
|
|
100
|
-
*/
|
|
101
|
-
enabled: boolean;
|
|
102
|
-
}
|
|
1
|
+
export interface FirebasePerformancePlugin {
|
|
2
|
+
/**
|
|
3
|
+
* Starts a trace.
|
|
4
|
+
*
|
|
5
|
+
* @since 0.1.0
|
|
6
|
+
*/
|
|
7
|
+
startTrace(options: StartTraceOptions): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Stops a trace.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.1.0
|
|
12
|
+
*/
|
|
13
|
+
stopTrace(options: StopTraceOptions): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.
|
|
16
|
+
*
|
|
17
|
+
* @since 0.1.0
|
|
18
|
+
*/
|
|
19
|
+
incrementMetric(options: IncrementMetricOptions): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Enables or disables performance monitoring.
|
|
22
|
+
* Will be applied with the next start of the app.
|
|
23
|
+
*
|
|
24
|
+
* @since 0.1.0
|
|
25
|
+
*/
|
|
26
|
+
setPerformanceCollectionEnabled(options: SetPerformanceCollectionEnabledOptions): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Determines whether performance monitoring is enabled or disabled.
|
|
29
|
+
*
|
|
30
|
+
* @since 0.1.0
|
|
31
|
+
*/
|
|
32
|
+
isPerformanceCollectionEnabled(): Promise<IsPerformanceCollectionEnabledResult>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @since 0.1.0
|
|
36
|
+
*/
|
|
37
|
+
export interface StartTraceOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Custom trace name.
|
|
40
|
+
*
|
|
41
|
+
* Names for custom code traces must meet the following requirements:
|
|
42
|
+
* no leading or trailing whitespace, no leading underscore (_) character,
|
|
43
|
+
* and max length is 100 characters.
|
|
44
|
+
*
|
|
45
|
+
* @since 0.1.0
|
|
46
|
+
*/
|
|
47
|
+
traceName: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @since 0.1.0
|
|
51
|
+
*/
|
|
52
|
+
export interface StopTraceOptions {
|
|
53
|
+
/**
|
|
54
|
+
* Name of the trace that was set with `startTrace`.
|
|
55
|
+
*
|
|
56
|
+
* @since 0.1.0
|
|
57
|
+
*/
|
|
58
|
+
traceName: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @since 0.1.0
|
|
62
|
+
*/
|
|
63
|
+
export interface IncrementMetricOptions {
|
|
64
|
+
/**
|
|
65
|
+
* Name of the trace that was set with `startTrace`.
|
|
66
|
+
*
|
|
67
|
+
* @since 0.1.0
|
|
68
|
+
*/
|
|
69
|
+
traceName: string;
|
|
70
|
+
/**
|
|
71
|
+
* Name of the metric to be incremented.
|
|
72
|
+
*
|
|
73
|
+
* @since 0.1.0
|
|
74
|
+
*/
|
|
75
|
+
metricName: string;
|
|
76
|
+
/**
|
|
77
|
+
* Amount by which the metric has to be incremented.
|
|
78
|
+
*
|
|
79
|
+
* @default 1
|
|
80
|
+
* @since 0.1.0
|
|
81
|
+
*/
|
|
82
|
+
incrementBy?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @since 0.1.0
|
|
86
|
+
*/
|
|
87
|
+
export interface SetPerformanceCollectionEnabledOptions {
|
|
88
|
+
/**
|
|
89
|
+
* Should performance monitoring be enabled.
|
|
90
|
+
*
|
|
91
|
+
* @since 0.1.0
|
|
92
|
+
*/
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface IsPerformanceCollectionEnabledResult {
|
|
96
|
+
/**
|
|
97
|
+
* `true` if performance monitoring is enabled, otherwise `false`.
|
|
98
|
+
*
|
|
99
|
+
* @since 0.1.0
|
|
100
|
+
*/
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
}
|
package/dist/esm/definitions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=definitions.js.map
|
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, 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
|
-
}
|
|
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
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 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
|
-
}
|
|
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
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,KAAK,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAW5E,MAAM,OAAO,sBACX,SAAQ,SAAS;IADnB;;
|
|
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;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{\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"]}
|
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 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
|
-
}
|
|
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
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';\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;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\r\nconst FirebasePerformance = registerPlugin('FirebasePerformance', {\r\n web: () => import('./web').then(m => new m.FirebasePerformanceWeb()),\r\n});\r\nexport * from './definitions';\r\nexport { FirebasePerformance };\r\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\r\nimport { getPerformance, trace as createTrace } from 'firebase/performance';\r\nexport class FirebasePerformanceWeb extends WebPlugin {\r\n constructor() {\r\n super(...arguments);\r\n this.traces = {};\r\n }\r\n async startTrace(options) {\r\n const perf = getPerformance();\r\n const trace = createTrace(perf, options.traceName);\r\n trace.start();\r\n this.traces[options.traceName] = trace;\r\n }\r\n async stopTrace(options) {\r\n const trace = this.traces[options.traceName];\r\n if (!trace) {\r\n return;\r\n }\r\n trace.stop();\r\n }\r\n async incrementMetric(options) {\r\n const trace = this.traces[options.traceName];\r\n if (!trace) {\r\n return;\r\n }\r\n trace.incrementMetric(options.metricName, options.incrementBy);\r\n }\r\n async setPerformanceCollectionEnabled(options) {\r\n const perf = getPerformance();\r\n perf.instrumentationEnabled = options.enabled;\r\n perf.dataCollectionEnabled = options.enabled;\r\n }\r\n async isPerformanceCollectionEnabled() {\r\n const perf = getPerformance();\r\n const result = {\r\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\r\n };\r\n return result;\r\n }\r\n}\r\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;;;;;;;;;"}
|