@capacitor-firebase/performance 0.3.1 → 0.5.1-dev.01021f0.1659726888

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.
@@ -1,46 +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
- }
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(setPerformanceCollectionEnabled, CAPPluginReturnPromise);
11
- CAP_PLUGIN_METHOD(isPerformanceCollectionEnabled, 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
+ )
@@ -1,83 +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
- }
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 setEnabled(_ call: CAPPluginCall) {
69
+ guard let enabled = call.getBool("enabled") else {
70
+ call.reject(errorEnabledMissing)
71
+ return
72
+ }
73
+ implementation?.setEnabled(enabled)
74
+ call.resolve()
75
+ }
76
+
77
+ @objc func isEnabled(_ call: CAPPluginCall) {
78
+ let enabled = implementation?.isEnabled()
79
+ var result = JSObject()
80
+ result["enabled"] = enabled
81
+ call.resolve(result)
82
+ }
83
+ }
@@ -1,24 +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>
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>
package/package.json CHANGED
@@ -1,84 +1,95 @@
1
- {
2
- "name": "@capacitor-firebase/performance",
3
- "version": "0.3.1",
4
- "description": "Capacitor plugin for Firebase Performance Monitoring.",
5
- "main": "dist/plugin.cjs.js",
6
- "module": "dist/esm/index.js",
7
- "types": "dist/esm/index.d.ts",
8
- "unpkg": "dist/plugin.js",
9
- "files": [
10
- "android/src/main/",
11
- "android/build.gradle",
12
- "dist/",
13
- "ios/Plugin/",
14
- "CapacitorFirebasePerformance.podspec"
15
- ],
16
- "author": "Robin Genz <mail@robingenz.dev>",
17
- "license": "Apache-2.0",
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/robingenz/capacitor-firebase.git"
21
- },
22
- "bugs": {
23
- "url": "https://github.com/robingenz/capacitor-firebase/issues"
24
- },
25
- "keywords": [
26
- "capacitor",
27
- "plugin",
28
- "native"
29
- ],
30
- "scripts": {
31
- "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
33
- "verify:android": "cd android && ./gradlew clean build test && cd ..",
34
- "verify:web": "npm run build",
35
- "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
36
- "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
37
- "eslint": "eslint . --ext ts",
38
- "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
39
- "swiftlint": "node-swiftlint",
40
- "docgen": "docgen --api FirebasePerformancePlugin --output-readme README.md --output-json dist/docs.json",
41
- "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
42
- "clean": "rimraf ./dist",
43
- "watch": "tsc --watch",
44
- "prepublishOnly": "npm run build"
45
- },
46
- "devDependencies": {
47
- "@capacitor/android": "3.4.0",
48
- "@capacitor/cli": "3.4.0",
49
- "@capacitor/core": "3.4.0",
50
- "@capacitor/docgen": "0.0.18",
51
- "@capacitor/ios": "3.4.0",
52
- "@ionic/eslint-config": "0.3.0",
53
- "@ionic/prettier-config": "1.0.1",
54
- "@ionic/swiftlint-config": "1.1.2",
55
- "eslint": "7.11.0",
56
- "firebase": "9.6.4",
57
- "prettier": "2.2.0",
58
- "prettier-plugin-java": "1.0.0",
59
- "rimraf": "3.0.2",
60
- "rollup": "2.32.0",
61
- "swiftlint": "1.0.1",
62
- "typescript": "4.0.3"
63
- },
64
- "peerDependencies": {
65
- "@capacitor/core": "^3.0.0",
66
- "firebase": "^9.0.0"
67
- },
68
- "prettier": "@ionic/prettier-config",
69
- "swiftlint": "@ionic/swiftlint-config",
70
- "eslintConfig": {
71
- "extends": "@ionic/eslint-config/recommended"
72
- },
73
- "capacitor": {
74
- "ios": {
75
- "src": "ios"
76
- },
77
- "android": {
78
- "src": "android"
79
- }
80
- },
81
- "publishConfig": {
82
- "access": "public"
83
- }
84
- }
1
+ {
2
+ "name": "@capacitor-firebase/performance",
3
+ "version": "0.5.1-dev.01021f0.1659726888",
4
+ "description": "Capacitor plugin for Firebase Performance Monitoring.",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/",
13
+ "ios/Plugin/",
14
+ "CapacitorFirebasePerformance.podspec"
15
+ ],
16
+ "author": "Robin Genz <mail@robingenz.dev>",
17
+ "license": "Apache-2.0",
18
+ "homepage": "https://capawesome.io/",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/capawesome-team/capacitor-firebase.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/capawesome-team/capacitor-firebase/issues"
25
+ },
26
+ "funding": [
27
+ {
28
+ "type": "github",
29
+ "url": "https://github.com/sponsors/capawesome-team/"
30
+ },
31
+ {
32
+ "type": "opencollective",
33
+ "url": "https://opencollective.com/capawesome"
34
+ }
35
+ ],
36
+ "keywords": [
37
+ "capacitor",
38
+ "plugin",
39
+ "native"
40
+ ],
41
+ "scripts": {
42
+ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
43
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
44
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
45
+ "verify:web": "npm run build",
46
+ "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
47
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
48
+ "eslint": "eslint . --ext ts",
49
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
50
+ "swiftlint": "node-swiftlint",
51
+ "docgen": "docgen --api FirebasePerformancePlugin --output-readme README.md --output-json dist/docs.json",
52
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
53
+ "clean": "rimraf ./dist",
54
+ "watch": "tsc --watch",
55
+ "prepublishOnly": "npm run build"
56
+ },
57
+ "devDependencies": {
58
+ "@capacitor/android": "4.0.1",
59
+ "@capacitor/cli": "4.0.1",
60
+ "@capacitor/core": "4.0.1",
61
+ "@capacitor/docgen": "0.2.0",
62
+ "@capacitor/ios": "4.0.1",
63
+ "@ionic/eslint-config": "0.3.0",
64
+ "@ionic/prettier-config": "1.0.1",
65
+ "@ionic/swiftlint-config": "1.1.2",
66
+ "eslint": "7.32.0",
67
+ "firebase": "9.6.4",
68
+ "prettier": "2.3.2",
69
+ "prettier-plugin-java": "1.0.2",
70
+ "rimraf": "3.0.2",
71
+ "rollup": "2.77.2",
72
+ "swiftlint": "1.0.1",
73
+ "typescript": "4.1.5"
74
+ },
75
+ "peerDependencies": {
76
+ "@capacitor/core": "^4.0.0",
77
+ "firebase": "^9.0.0"
78
+ },
79
+ "prettier": "@ionic/prettier-config",
80
+ "swiftlint": "@ionic/swiftlint-config",
81
+ "eslintConfig": {
82
+ "extends": "@ionic/eslint-config/recommended"
83
+ },
84
+ "capacitor": {
85
+ "ios": {
86
+ "src": "ios"
87
+ },
88
+ "android": {
89
+ "src": "android"
90
+ }
91
+ },
92
+ "publishConfig": {
93
+ "access": "public"
94
+ }
95
+ }
@@ -1,92 +0,0 @@
1
- package dev.robingenz.capacitorjs.plugins.firebase.performance;
2
-
3
- import com.getcapacitor.JSObject;
4
- import com.getcapacitor.Plugin;
5
- import com.getcapacitor.PluginCall;
6
- import com.getcapacitor.PluginMethod;
7
- import com.getcapacitor.annotation.CapacitorPlugin;
8
- import com.google.firebase.perf.metrics.Trace;
9
-
10
- @CapacitorPlugin(name = "FirebasePerformance")
11
- public class FirebasePerformancePlugin extends Plugin {
12
-
13
- public static final String ERROR_TRACE_NAME_MISSING = "traceName must be provided.";
14
- public static final String ERROR_METRIC_NAME_MISSING = "metricName must be provided.";
15
- public static final String ERROR_TRACE_NAME_ALREADY_ASSIGNED = "traceName already assigned.";
16
- public static final String ERROR_ENABLED_MISSING = "enabled must be provided.";
17
- public static final String ERROR_TRACE_NOT_FOUND = "No trace was found with the provided traceName.";
18
- private FirebasePerformance implementation = new FirebasePerformance();
19
-
20
- @PluginMethod
21
- public void startTrace(PluginCall call) {
22
- String traceName = call.getString("traceName");
23
- if (traceName == null) {
24
- call.reject(ERROR_TRACE_NAME_MISSING);
25
- return;
26
- }
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
- }
35
-
36
- @PluginMethod
37
- public void stopTrace(PluginCall call) {
38
- String traceName = call.getString("traceName");
39
- if (traceName == null) {
40
- call.reject(ERROR_TRACE_NAME_MISSING);
41
- return;
42
- }
43
- Trace trace = implementation.getTraceByName(traceName);
44
- if (trace == null) {
45
- call.reject(ERROR_TRACE_NOT_FOUND);
46
- return;
47
- }
48
- implementation.stopTrace(traceName);
49
- call.resolve();
50
- }
51
-
52
- @PluginMethod
53
- public void incrementMetric(PluginCall call) {
54
- String traceName = call.getString("traceName");
55
- String metricName = call.getString("metricName");
56
- Integer incrementBy = call.getInt("incrementBy", 1);
57
- if (traceName == null) {
58
- call.reject(ERROR_TRACE_NAME_MISSING);
59
- return;
60
- }
61
- if (metricName == null) {
62
- call.reject(ERROR_METRIC_NAME_MISSING);
63
- return;
64
- }
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
- }
73
-
74
- @PluginMethod
75
- public void setPerformanceCollectionEnabled(PluginCall call) {
76
- Boolean enabled = call.getBoolean("enabled");
77
- if (enabled == null) {
78
- call.reject(ERROR_ENABLED_MISSING);
79
- return;
80
- }
81
- implementation.setPerformanceCollectionEnabled(enabled);
82
- call.resolve();
83
- }
84
-
85
- @PluginMethod
86
- public void isPerformanceCollectionEnabled(PluginCall call) {
87
- Boolean enabled = implementation.isPerformanceCollectionEnabled();
88
- JSObject result = new JSObject();
89
- result.put("enabled", enabled);
90
- call.resolve(result);
91
- }
92
- }