@capacitor/background-runner 2.1.0 → 2.3.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.
Files changed (50) hide show
  1. package/CapacitorBackgroundRunner.podspec +1 -1
  2. package/Package.swift +45 -0
  3. package/README.md +65 -3
  4. package/android/src/main/java/io/ionic/backgroundrunner/plugin/BackgroundRunnerPlugin.kt +45 -1
  5. package/android/src/main/java/io/ionic/backgroundrunner/plugin/api/Notification.kt +4 -2
  6. package/android/src/main/java/io/ionic/backgroundrunner/plugin/api/Notifications.kt +21 -0
  7. package/android/src/main/libs/android-js-engine-release.aar +0 -0
  8. package/dist/docs.json +83 -0
  9. package/dist/esm/definitions.d.ts +17 -1
  10. package/dist/esm/definitions.js.map +1 -1
  11. package/dist/esm/index.js +2 -2
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/web.d.ts +4 -1
  14. package/dist/esm/web.js +6 -0
  15. package/dist/esm/web.js.map +1 -1
  16. package/dist/plugin.cjs.js +8 -4
  17. package/dist/plugin.cjs.js.map +1 -1
  18. package/dist/plugin.js +8 -4
  19. package/dist/plugin.js.map +1 -1
  20. package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/BackgroundRunner.swift +26 -11
  21. package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/CapacitorAPI/Geolocation.swift +21 -9
  22. package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/CapacitorAPI/Notifications.swift +4 -3
  23. package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/CapacitorAPI/Reachability.swift +1 -1
  24. package/ios/{Plugin/BackgroundRunnerPlugin.swift → Sources/CapacitorBackgroundRunner/CapacitorBackgroundRunner.swift} +104 -1
  25. package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/Context+CapacitorAPI.swift +8 -2
  26. package/ios/{Plugin → Sources}/RunnerEngine/Context.swift +1 -1
  27. package/ios/{Plugin → Sources}/RunnerEngine/JSCrypto.swift +3 -3
  28. package/ios/{Plugin → Sources}/RunnerEngine/JSError.swift +1 -1
  29. package/ios/{Plugin → Sources}/RunnerEngine/Runner.swift +1 -1
  30. package/ios/Tests/CapacitorBackgroundRunnerTests/CapacitorBackgroundRunnerTests.swift +21 -0
  31. package/ios/Tests/RunnerEngineTests/ContextTests.swift +393 -0
  32. package/ios/Tests/RunnerEngineTests/RunnerTests.swift +32 -0
  33. package/package.json +24 -22
  34. package/scripts/install_libs.js +4 -12
  35. package/ios/Plugin/BackgroundRunnerPlugin.h +0 -10
  36. package/ios/Plugin/BackgroundRunnerPlugin.m +0 -11
  37. package/ios/Plugin/Info.plist +0 -24
  38. /package/ios/{Plugin/BackgroundRunnerErrors.swift → Sources/CapacitorBackgroundRunner/BackgroundRunnerPluginError.swift} +0 -0
  39. /package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/CapacitorAPI/App.swift +0 -0
  40. /package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/CapacitorAPI/Device.swift +0 -0
  41. /package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/CapacitorAPI/KV.swift +0 -0
  42. /package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/CapacitorAPI/Watch.swift +0 -0
  43. /package/ios/{Plugin → Sources/CapacitorBackgroundRunner}/RunnerConfig.swift +0 -0
  44. /package/ios/{Plugin/WatchConnectivtySessionDelegate.swift → Sources/CapacitorBackgroundRunner/WatchConnectivitySessionDelegate.swift} +0 -0
  45. /package/ios/{Plugin → Sources}/RunnerEngine/Errors.swift +0 -0
  46. /package/ios/{Plugin → Sources}/RunnerEngine/JSConsole.swift +0 -0
  47. /package/ios/{Plugin → Sources}/RunnerEngine/JSFetch.swift +0 -0
  48. /package/ios/{Plugin → Sources}/RunnerEngine/JSResponse.swift +0 -0
  49. /package/ios/{Plugin → Sources}/RunnerEngine/JSTextDecoder.swift +0 -0
  50. /package/ios/{Plugin → Sources}/RunnerEngine/JSTextEncoder.swift +0 -0
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.homepage = package['repository']['url']
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'packages/capacitor-plugin/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'packages/ios-engine/Sources/RunnerEngine/*.swift'
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '14.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
package/Package.swift ADDED
@@ -0,0 +1,45 @@
1
+ // swift-tools-version: 5.7
2
+ // The swift-tools-version declares the minimum version of Swift required to build this package.
3
+
4
+ import PackageDescription
5
+
6
+ let package = Package(
7
+ name: "CapacitorBackgroundRunner",
8
+ platforms: [.iOS(.v14), .macOS(.v13)],
9
+ products: [
10
+ // Products define the executables and libraries a package produces, making them visible to other packages.
11
+ .library(
12
+ name: "CapacitorBackgroundRunner",
13
+ targets: ["CapacitorBackgroundRunner"]
14
+ )
15
+ ],
16
+ dependencies: [
17
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
18
+ ],
19
+ targets: [
20
+ // Targets are the basic building blocks of a package, defining a module or a test suite.
21
+ // Targets can depend on other targets in this package and products from dependencies.
22
+ .target(
23
+ name: "CapacitorBackgroundRunner",
24
+ dependencies: [
25
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
26
+ .product(name: "Cordova", package: "capacitor-swift-pm"),
27
+ "RunnerEngine"
28
+ ],
29
+ path: "ios/Sources/CapacitorBackgroundRunner"
30
+ ),
31
+ .target(
32
+ name: "RunnerEngine",
33
+ dependencies: [],
34
+ path: "ios/Sources/RunnerEngine"),
35
+ .testTarget(
36
+ name: "RunnerEngineTests",
37
+ dependencies: ["RunnerEngine"],
38
+ path: "ios/Tests/RunnerEngineTests"),
39
+ .testTarget(
40
+ name: "CapacitorBackgroundRunnerTests",
41
+ dependencies: ["CapacitorBackgroundRunner"],
42
+ path: "ios/Tests/CapacitorBackgroundRunnerTests"
43
+ )
44
+ ]
45
+ )
package/README.md CHANGED
@@ -23,6 +23,18 @@ If you will be making use of Geolocation or Push Notifications, enable `Location
23
23
 
24
24
  ![Configure Background Modes in Xcode](https://github.com/ionic-team/capacitor-background-runner/raw/main/docs/configure_background_modes.png)
25
25
 
26
+ You will also need to add the following entry into your `Info.plist` file:
27
+ ```
28
+ <key>BGTaskSchedulerPermittedIdentifiers</key>
29
+ <array>
30
+ <string>com.example.background.task</string>
31
+ </array>
32
+ ```
33
+
34
+ Read about [Configuring `Info.plist`](https://capacitorjs.com/docs/ios/configuration#configuring-infoplist) in the [iOS Guide](https://capacitorjs.com/docs/ios) for more information on setting iOS permissions in Xcode.
35
+
36
+ Make sure you use the same id that you use for `BGTaskSchedulerPermittedIdentifiers` (for example "com.example.background.task") in the `label` field in the plugin configuration.
37
+
26
38
  After enabling the Background Modes capability, add the following to your app's `AppDelegate.swift`:
27
39
 
28
40
  At the top of the file, under `import Capacitor` add:
@@ -65,8 +77,6 @@ Apple requires privacy descriptions to be specified in `Info.plist` for location
65
77
  - `NSLocationAlwaysUsageDescription` (`Privacy - Location Always Usage Description`)
66
78
  - `NSLocationWhenInUseUsageDescription` (`Privacy - Location When In Use Usage Description`)
67
79
 
68
- Read about [Configuring `Info.plist`](https://capacitorjs.com/docs/ios/configuration#configuring-infoplist) in the [iOS Guide](https://capacitorjs.com/docs/ios) for more information on setting iOS permissions in Xcode
69
-
70
80
  ## Android
71
81
 
72
82
  Insert the following line to `android/app/build.gradle`:
@@ -269,7 +279,7 @@ Visit [Don't kill my app!](https://dontkillmyapp.com) for more information on th
269
279
 
270
280
  ## Limitations of Background Tasks
271
281
 
272
- It’s not possible to run persistent, always running background services on mobile operating systems. Due to the limitations imposed by iOS and Android designed to reduce battery and data consumption, background tasks are constrained with various limitations that you must keep in mind while designing and implementing your background task.
282
+ It's not possible to run persistent, always running background services on mobile operating systems. Due to the limitations imposed by iOS and Android designed to reduce battery and data consumption, background tasks are constrained with various limitations that you must keep in mind while designing and implementing your background task.
273
283
 
274
284
  ### iOS
275
285
 
@@ -289,6 +299,8 @@ It’s not possible to run persistent, always running background services on mob
289
299
  * [`checkPermissions()`](#checkpermissions)
290
300
  * [`requestPermissions(...)`](#requestpermissions)
291
301
  * [`dispatchEvent(...)`](#dispatchevent)
302
+ * [`addListener('backgroundRunnerNotificationReceived', ...)`](#addlistenerbackgroundrunnernotificationreceived-)
303
+ * [`removeNotificationListeners()`](#removenotificationlisteners)
292
304
  * [Interfaces](#interfaces)
293
305
  * [Type Aliases](#type-aliases)
294
306
 
@@ -350,6 +362,41 @@ Dispatches an event to the configured runner.
350
362
  --------------------
351
363
 
352
364
 
365
+ ### addListener('backgroundRunnerNotificationReceived', ...)
366
+
367
+ ```typescript
368
+ addListener(eventName: 'backgroundRunnerNotificationReceived', listenerFunc: (event: NotificationActionEvent) => void) => any
369
+ ```
370
+
371
+ Add a listener for notification actions.
372
+
373
+ | Param | Type |
374
+ | ------------------ | ----------------------------------------------------------------------------------------------- |
375
+ | **`eventName`** | <code>'backgroundRunnerNotificationReceived'</code> |
376
+ | **`listenerFunc`** | <code>(event: <a href="#notificationactionevent">NotificationActionEvent</a>) =&gt; void</code> |
377
+
378
+ **Returns:** <code>any</code>
379
+
380
+ **Since:** 2.1.1
381
+
382
+ --------------------
383
+
384
+
385
+ ### removeNotificationListeners()
386
+
387
+ ```typescript
388
+ removeNotificationListeners() => any
389
+ ```
390
+
391
+ Remove notification action listeners for this plugin.
392
+
393
+ **Returns:** <code>any</code>
394
+
395
+ **Since:** 2.1.1
396
+
397
+ --------------------
398
+
399
+
353
400
  ### Interfaces
354
401
 
355
402
 
@@ -377,6 +424,21 @@ Dispatches an event to the configured runner.
377
424
  | **`details`** | <code>{ [key: string]: any; }</code> | | |
378
425
 
379
426
 
427
+ #### NotificationActionEvent
428
+
429
+ | Prop | Type |
430
+ | -------------------- | ------------------- |
431
+ | **`actionTypeId`** | <code>string</code> |
432
+ | **`notificationId`** | <code>number</code> |
433
+
434
+
435
+ #### PluginListenerHandle
436
+
437
+ | Prop | Type |
438
+ | ------------ | ------------------------- |
439
+ | **`remove`** | <code>() =&gt; any</code> |
440
+
441
+
380
442
  ### Type Aliases
381
443
 
382
444
 
@@ -14,10 +14,12 @@ import kotlinx.coroutines.Dispatchers
14
14
  import kotlinx.coroutines.GlobalScope
15
15
  import kotlinx.coroutines.launch
16
16
  import kotlinx.coroutines.runBlocking
17
+ import android.content.Intent
18
+ import com.getcapacitor.Bridge
17
19
 
18
20
 
19
21
  @CapacitorPlugin(
20
- name = "BackgroundRunner",
22
+ name = "CapacitorBackgroundRunner",
21
23
  permissions = [
22
24
  Permission(
23
25
  strings = [Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION],
@@ -125,4 +127,46 @@ class BackgroundRunnerPlugin: Plugin() {
125
127
  fun registerBackgroundTask(call: PluginCall) {
126
128
  call.resolve()
127
129
  }
130
+
131
+ override fun handleOnNewIntent(intent: Intent) {
132
+ super.handleOnNewIntent(intent)
133
+
134
+ Log.d("BackgroundRunner", "handleOnNewIntent with action: ${intent.action}")
135
+
136
+ if (intent.action == ".NOTIFICATION_CLICKED") {
137
+ val actionTypeId = intent.getStringExtra("actionTypeId")
138
+ val notificationId = intent.getIntExtra("notificationId", -1)
139
+
140
+ // Create notification action data
141
+ val notificationAction = if (actionTypeId != null) {
142
+ JSObject().apply {
143
+ put("actionTypeId", actionTypeId)
144
+ put("notificationId", notificationId)
145
+ }
146
+ } else null
147
+
148
+ // Launch the app using proper intent flags
149
+ val packageName = context.packageName
150
+ val launchIntent = context.packageManager.getLaunchIntentForPackage(packageName)?.apply {
151
+ action = Intent.ACTION_MAIN
152
+ addCategory(Intent.CATEGORY_LAUNCHER)
153
+ flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
154
+ }
155
+
156
+ if (launchIntent != null) {
157
+ context.startActivity(launchIntent)
158
+
159
+ // Notify listeners about the action with retention
160
+ notificationAction?.let {
161
+ notifyListeners("backgroundRunnerNotificationReceived", it, true)
162
+ }
163
+ }
164
+ }
165
+ }
166
+
167
+ @PluginMethod
168
+ fun removeNotificationListeners(call: PluginCall) {
169
+ notifyListeners("backgroundRunnerNotificationReceived", null)
170
+ call.resolve()
171
+ }
128
172
  }
@@ -20,7 +20,7 @@ class Notification(jsonObject: JSONObject) {
20
20
  var sound: String? = null
21
21
  var smallIcon: String? = null
22
22
  var largeIcon: String? = null
23
- var actionTypeID: String? = null
23
+ var actionTypeId: String? = null
24
24
  var extra: HashMap<String, Any>? = null
25
25
  var group: String? = null
26
26
  var groupSummary: String? = null
@@ -32,8 +32,10 @@ class Notification(jsonObject: JSONObject) {
32
32
  id = jsonObject.optInt("id", -1)
33
33
  title = jsonObject.optString("title", "")
34
34
  body = jsonObject.optString("body", "")
35
+ smallIcon = jsonObject.optString("smallIcon", "")
35
36
  ongoing = jsonObject.optBoolean("ongoing", false)
36
37
  autoCancel = jsonObject.optBoolean("autoCancel", false)
38
+ actionTypeId = jsonObject.optString("actionTypeId", null)
37
39
 
38
40
  val scheduleDateString = jsonObject.optString("scheduleAt", "")
39
41
  if (scheduleDateString.isNotEmpty()) {
@@ -59,4 +61,4 @@ class Notification(jsonObject: JSONObject) {
59
61
 
60
62
  return resId
61
63
  }
62
- }
64
+ }
@@ -92,6 +92,27 @@ class Notifications(context: Context) : NotificationsAPI {
92
92
  builder.setGroupSummary(it.groupSummary != null)
93
93
  builder.setSmallIcon(it.smallIcon(this.context, getDefaultSmallIcon()))
94
94
 
95
+ // Add action intent handling
96
+ val actionIntent = Intent(".NOTIFICATION_CLICKED").apply {
97
+ `package` = context.packageName
98
+ putExtra("actionTypeId", it.actionTypeId)
99
+ putExtra("notificationId", it.id)
100
+ }
101
+
102
+ val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
103
+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
104
+ } else {
105
+ PendingIntent.FLAG_UPDATE_CURRENT
106
+ }
107
+
108
+ val pendingActionIntent = PendingIntent.getActivity(
109
+ context,
110
+ it.id,
111
+ actionIntent,
112
+ flags
113
+ )
114
+ builder.setContentIntent(pendingActionIntent)
115
+
95
116
  val largeBody = it.largeBody
96
117
  if (largeBody != null) {
97
118
  val style = NotificationCompat.BigTextStyle()
package/dist/docs.json CHANGED
@@ -73,6 +73,50 @@
73
73
  "T"
74
74
  ],
75
75
  "slug": "dispatchevent"
76
+ },
77
+ {
78
+ "name": "addListener",
79
+ "signature": "(eventName: 'backgroundRunnerNotificationReceived', listenerFunc: (event: NotificationActionEvent) => void) => any",
80
+ "parameters": [
81
+ {
82
+ "name": "eventName",
83
+ "docs": "",
84
+ "type": "'backgroundRunnerNotificationReceived'"
85
+ },
86
+ {
87
+ "name": "listenerFunc",
88
+ "docs": "",
89
+ "type": "(event: NotificationActionEvent) => void"
90
+ }
91
+ ],
92
+ "returns": "any",
93
+ "tags": [
94
+ {
95
+ "name": "since",
96
+ "text": "2.1.1"
97
+ }
98
+ ],
99
+ "docs": "Add a listener for notification actions.",
100
+ "complexTypes": [
101
+ "NotificationActionEvent",
102
+ "PluginListenerHandle"
103
+ ],
104
+ "slug": "addlistenerbackgroundrunnernotificationreceived-"
105
+ },
106
+ {
107
+ "name": "removeNotificationListeners",
108
+ "signature": "() => any",
109
+ "parameters": [],
110
+ "returns": "any",
111
+ "tags": [
112
+ {
113
+ "name": "since",
114
+ "text": "2.1.1"
115
+ }
116
+ ],
117
+ "docs": "Remove notification action listeners for this plugin.",
118
+ "complexTypes": [],
119
+ "slug": "removenotificationlisteners"
76
120
  }
77
121
  ],
78
122
  "properties": []
@@ -162,6 +206,45 @@
162
206
  "type": "{ [key: string]: any; }"
163
207
  }
164
208
  ]
209
+ },
210
+ {
211
+ "name": "NotificationActionEvent",
212
+ "slug": "notificationactionevent",
213
+ "docs": "",
214
+ "tags": [],
215
+ "methods": [],
216
+ "properties": [
217
+ {
218
+ "name": "actionTypeId",
219
+ "tags": [],
220
+ "docs": "",
221
+ "complexTypes": [],
222
+ "type": "string"
223
+ },
224
+ {
225
+ "name": "notificationId",
226
+ "tags": [],
227
+ "docs": "",
228
+ "complexTypes": [],
229
+ "type": "number"
230
+ }
231
+ ]
232
+ },
233
+ {
234
+ "name": "PluginListenerHandle",
235
+ "slug": "pluginlistenerhandle",
236
+ "docs": "",
237
+ "tags": [],
238
+ "methods": [],
239
+ "properties": [
240
+ {
241
+ "name": "remove",
242
+ "tags": [],
243
+ "docs": "",
244
+ "complexTypes": [],
245
+ "type": "() => any"
246
+ }
247
+ ]
165
248
  }
166
249
  ],
167
250
  "enums": [],
@@ -1,4 +1,4 @@
1
- import type { PermissionState } from '@capacitor/core';
1
+ import type { PermissionState, PluginListenerHandle } from '@capacitor/core';
2
2
  export interface BackgroundRunnerConfig {
3
3
  /**
4
4
  * The name of the runner, used in logs.
@@ -122,6 +122,10 @@ export interface RequestPermissionOptions {
122
122
  export interface RegisterBackgroundTaskOptions {
123
123
  runner: BackgroundRunnerConfig;
124
124
  }
125
+ export interface NotificationActionEvent {
126
+ actionTypeId: string;
127
+ notificationId: number;
128
+ }
125
129
  export interface BackgroundRunnerPlugin {
126
130
  /**
127
131
  * Check permissions for the various Capacitor device APIs.
@@ -141,6 +145,18 @@ export interface BackgroundRunnerPlugin {
141
145
  * @since 1.0.0
142
146
  */
143
147
  dispatchEvent<T = void>(options: DispatchEventOptions): Promise<T>;
148
+ /**
149
+ * Add a listener for notification actions.
150
+ *
151
+ * @since 2.1.1
152
+ */
153
+ addListener(eventName: 'backgroundRunnerNotificationReceived', listenerFunc: (event: NotificationActionEvent) => void): Promise<PluginListenerHandle>;
154
+ /**
155
+ * Remove notification action listeners for this plugin.
156
+ *
157
+ * @since 2.1.1
158
+ */
159
+ removeNotificationListeners(): Promise<void>;
144
160
  }
145
161
  declare module '@capacitor/cli' {
146
162
  interface PluginsConfig {
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PermissionState } from '@capacitor/core';\n\nexport interface BackgroundRunnerConfig {\n /**\n * The name of the runner, used in logs.\n *\n * @since 1.0.0\n */\n label: string;\n /**\n * The path to the runner JavaScript file, relative to the app bundle.\n *\n * @since 1.0.0\n */\n src: string;\n /**\n * The name of the event that will be called when the OS executes the background task.\n *\n * @since 1.0.0\n */\n event: string;\n /**\n * If background task should repeat based on the interval set in `interval`.\n *\n * @since 1.0.0\n */\n repeat: boolean;\n /**\n * The number of minutes after the the app is put into the background in which the background task should begin.\n *\n * If `repeat` is true, this also specifies the number of minutes between each execution.\n *\n * @since 1.0.0\n */\n interval: number;\n /**\n * Automatically register and schedule background task on app load.\n *\n * @since 1.0.0\n */\n autoStart?: boolean;\n}\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * On load, Background Runner will automatically register a\n * background task that will be scheduled and run once your app is\n * backgrounded.\n */\n BackgroundRunner?: {\n /**\n * The name of the runner, used in logs.\n *\n * @since 1.0.0\n * @example \"com.example.background.task\"\n */\n label: string;\n /**\n * The path to the runner JavaScript file, relative to the app bundle.\n *\n * @since 1.0.0\n * @example \"runners/background.js\"\n */\n src: string;\n /**\n * The name of the event that will be called when the OS executes the background task.\n *\n * @since 1.0.0\n * @example \"myCustomEvent\"\n */\n event: string;\n /**\n * If background task should repeat based on the interval set in `interval`.\n *\n * @since 1.0.0\n * @example true\n */\n repeat: boolean;\n /**\n * The number of minutes after the the app is put into the background in which the background task should begin.\n *\n * If `repeat` is true, this also specifies the number of minutes between each execution.\n *\n * @since 1.0.0\n * @example 15\n */\n interval: number;\n /**\n * Automatically register and schedule background task on app load.\n *\n * @since 1.0.0\n * @example true\n */\n autoStart?: boolean;\n };\n }\n}\n\nexport type API = 'geolocation' | 'notifications';\n\nexport interface PermissionStatus {\n geolocation: PermissionState;\n notifications: PermissionState;\n}\n\nexport interface DispatchEventOptions {\n /**\n * The runner label to dispatch the event to\n *\n * @since 1.0.0\n */\n label: string;\n /**\n * The name of the registered event listener.\n *\n * @since 1.0.0\n */\n event: string;\n details: { [key: string]: any };\n}\n\nexport interface RequestPermissionOptions {\n apis: API[];\n}\n\nexport interface RegisterBackgroundTaskOptions {\n runner: BackgroundRunnerConfig;\n}\n\nexport interface BackgroundRunnerPlugin {\n /**\n * Check permissions for the various Capacitor device APIs.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n /**\n * Request permission to display local notifications.\n *\n * @since 1.0.0\n */\n requestPermissions(\n options: RequestPermissionOptions,\n ): Promise<PermissionStatus>;\n /**\n * Dispatches an event to the configured runner.\n * @param options\n * @since 1.0.0\n */\n dispatchEvent<T = void>(options: DispatchEventOptions): Promise<T>;\n}\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n BackgroundRunner?: BackgroundRunnerConfig;\n }\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\nexport interface BackgroundRunnerConfig {\n /**\n * The name of the runner, used in logs.\n *\n * @since 1.0.0\n */\n label: string;\n /**\n * The path to the runner JavaScript file, relative to the app bundle.\n *\n * @since 1.0.0\n */\n src: string;\n /**\n * The name of the event that will be called when the OS executes the background task.\n *\n * @since 1.0.0\n */\n event: string;\n /**\n * If background task should repeat based on the interval set in `interval`.\n *\n * @since 1.0.0\n */\n repeat: boolean;\n /**\n * The number of minutes after the the app is put into the background in which the background task should begin.\n *\n * If `repeat` is true, this also specifies the number of minutes between each execution.\n *\n * @since 1.0.0\n */\n interval: number;\n /**\n * Automatically register and schedule background task on app load.\n *\n * @since 1.0.0\n */\n autoStart?: boolean;\n}\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * On load, Background Runner will automatically register a\n * background task that will be scheduled and run once your app is\n * backgrounded.\n */\n BackgroundRunner?: {\n /**\n * The name of the runner, used in logs.\n *\n * @since 1.0.0\n * @example \"com.example.background.task\"\n */\n label: string;\n /**\n * The path to the runner JavaScript file, relative to the app bundle.\n *\n * @since 1.0.0\n * @example \"runners/background.js\"\n */\n src: string;\n /**\n * The name of the event that will be called when the OS executes the background task.\n *\n * @since 1.0.0\n * @example \"myCustomEvent\"\n */\n event: string;\n /**\n * If background task should repeat based on the interval set in `interval`.\n *\n * @since 1.0.0\n * @example true\n */\n repeat: boolean;\n /**\n * The number of minutes after the the app is put into the background in which the background task should begin.\n *\n * If `repeat` is true, this also specifies the number of minutes between each execution.\n *\n * @since 1.0.0\n * @example 15\n */\n interval: number;\n /**\n * Automatically register and schedule background task on app load.\n *\n * @since 1.0.0\n * @example true\n */\n autoStart?: boolean;\n };\n }\n}\n\nexport type API = 'geolocation' | 'notifications';\n\nexport interface PermissionStatus {\n geolocation: PermissionState;\n notifications: PermissionState;\n}\n\nexport interface DispatchEventOptions {\n /**\n * The runner label to dispatch the event to\n *\n * @since 1.0.0\n */\n label: string;\n /**\n * The name of the registered event listener.\n *\n * @since 1.0.0\n */\n event: string;\n details: { [key: string]: any };\n}\n\nexport interface RequestPermissionOptions {\n apis: API[];\n}\n\nexport interface RegisterBackgroundTaskOptions {\n runner: BackgroundRunnerConfig;\n}\n\nexport interface NotificationActionEvent {\n actionTypeId: string;\n notificationId: number;\n}\n\nexport interface BackgroundRunnerPlugin {\n /**\n * Check permissions for the various Capacitor device APIs.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n /**\n * Request permission to display local notifications.\n *\n * @since 1.0.0\n */\n requestPermissions(options: RequestPermissionOptions): Promise<PermissionStatus>;\n /**\n * Dispatches an event to the configured runner.\n * @param options\n * @since 1.0.0\n */\n dispatchEvent<T = void>(options: DispatchEventOptions): Promise<T>;\n /**\n * Add a listener for notification actions.\n *\n * @since 2.1.1\n */\n addListener(\n eventName: 'backgroundRunnerNotificationReceived',\n listenerFunc: (event: NotificationActionEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove notification action listeners for this plugin.\n *\n * @since 2.1.1\n */\n removeNotificationListeners(): Promise<void>;\n}\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n BackgroundRunner?: BackgroundRunnerConfig;\n }\n}\n"]}
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { registerPlugin } from '@capacitor/core';
2
- const BackgroundRunner = registerPlugin('BackgroundRunner', {
3
- web: () => import('./web').then(m => new m.BackgroundRunnerWeb()),
2
+ const BackgroundRunner = registerPlugin('CapacitorBackgroundRunner', {
3
+ web: () => import('./web').then((m) => new m.BackgroundRunnerWeb()),
4
4
  });
5
5
  export * from './definitions';
6
6
  export * from './apis';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,gBAAgB,GAAG,cAAc,CACrC,kBAAkB,EAClB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;CAClE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { BackgroundRunnerPlugin } from './definitions';\n\nconst BackgroundRunner = registerPlugin<BackgroundRunnerPlugin>(\n 'BackgroundRunner',\n {\n web: () => import('./web').then(m => new m.BackgroundRunnerWeb()),\n },\n);\n\nexport * from './definitions';\nexport * from './apis';\n\nexport { BackgroundRunner };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,gBAAgB,GAAG,cAAc,CAAyB,2BAA2B,EAAE;IAC3F,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;CACpE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { BackgroundRunnerPlugin } from './definitions';\n\nconst BackgroundRunner = registerPlugin<BackgroundRunnerPlugin>('CapacitorBackgroundRunner', {\n web: () => import('./web').then((m) => new m.BackgroundRunnerWeb()),\n});\n\nexport * from './definitions';\nexport * from './apis';\n\nexport { BackgroundRunner };\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
1
2
  import { WebPlugin } from '@capacitor/core';
2
- import type { BackgroundRunnerPlugin, DispatchEventOptions, PermissionStatus } from './definitions';
3
+ import type { BackgroundRunnerPlugin, DispatchEventOptions, PermissionStatus, NotificationActionEvent } from './definitions';
3
4
  export declare class BackgroundRunnerWeb extends WebPlugin implements BackgroundRunnerPlugin {
4
5
  checkPermissions(): Promise<PermissionStatus>;
5
6
  requestPermissions(): Promise<PermissionStatus>;
6
7
  registerBackgroundTask(): Promise<void>;
7
8
  dispatchEvent<T = void>(_options: DispatchEventOptions): Promise<T>;
9
+ addListener(_eventName: 'backgroundRunnerNotificationReceived', _listenerFunc: (event: NotificationActionEvent) => void): Promise<PluginListenerHandle>;
10
+ removeNotificationListeners(): Promise<void>;
8
11
  }
package/dist/esm/web.js CHANGED
@@ -12,5 +12,11 @@ export class BackgroundRunnerWeb extends WebPlugin {
12
12
  dispatchEvent(_options) {
13
13
  throw new Error('not available on web');
14
14
  }
15
+ async addListener(_eventName, _listenerFunc) {
16
+ throw new Error('not available on web');
17
+ }
18
+ async removeNotificationListeners() {
19
+ throw new Error('not available on web');
20
+ }
15
21
  }
16
22
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,OAAO,mBACX,SAAQ,SAAS;IAGjB,gBAAgB;QACd,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,kBAAkB;QAChB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,sBAAsB;QACpB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,aAAa,CAAW,QAA8B;QACpD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n BackgroundRunnerPlugin,\n DispatchEventOptions,\n PermissionStatus,\n} from './definitions';\n\nexport class BackgroundRunnerWeb\n extends WebPlugin\n implements BackgroundRunnerPlugin\n{\n checkPermissions(): Promise<PermissionStatus> {\n throw new Error('not available on web');\n }\n\n requestPermissions(): Promise<PermissionStatus> {\n throw new Error('not available on web');\n }\n\n registerBackgroundTask(): Promise<void> {\n throw new Error('not available on web');\n }\n\n dispatchEvent<T = void>(_options: DispatchEventOptions): Promise<T> {\n throw new Error('not available on web');\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,gBAAgB;QACd,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,kBAAkB;QAChB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,sBAAsB;QACpB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,aAAa,CAAW,QAA8B;QACpD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,WAAW,CACf,UAAkD,EAClD,aAAuD;QAEvD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,2BAA2B;QAC/B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\nimport { WebPlugin } from '@capacitor/core';\n\nimport type {\n BackgroundRunnerPlugin,\n DispatchEventOptions,\n PermissionStatus,\n NotificationActionEvent,\n} from './definitions';\n\nexport class BackgroundRunnerWeb extends WebPlugin implements BackgroundRunnerPlugin {\n checkPermissions(): Promise<PermissionStatus> {\n throw new Error('not available on web');\n }\n\n requestPermissions(): Promise<PermissionStatus> {\n throw new Error('not available on web');\n }\n\n registerBackgroundTask(): Promise<void> {\n throw new Error('not available on web');\n }\n\n dispatchEvent<T = void>(_options: DispatchEventOptions): Promise<T> {\n throw new Error('not available on web');\n }\n\n async addListener(\n _eventName: 'backgroundRunnerNotificationReceived',\n _listenerFunc: (event: NotificationActionEvent) => void,\n ): Promise<PluginListenerHandle> {\n throw new Error('not available on web');\n }\n\n async removeNotificationListeners(): Promise<void> {\n throw new Error('not available on web');\n }\n}\n"]}
@@ -1,11 +1,9 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var core = require('@capacitor/core');
6
4
 
7
- const BackgroundRunner = core.registerPlugin('BackgroundRunner', {
8
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.BackgroundRunnerWeb()),
5
+ const BackgroundRunner = core.registerPlugin('CapacitorBackgroundRunner', {
6
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.BackgroundRunnerWeb()),
9
7
  });
10
8
 
11
9
  class BackgroundRunnerWeb extends core.WebPlugin {
@@ -21,6 +19,12 @@ class BackgroundRunnerWeb extends core.WebPlugin {
21
19
  dispatchEvent(_options) {
22
20
  throw new Error('not available on web');
23
21
  }
22
+ async addListener(_eventName, _listenerFunc) {
23
+ throw new Error('not available on web');
24
+ }
25
+ async removeNotificationListeners() {
26
+ throw new Error('not available on web');
27
+ }
24
28
  }
25
29
 
26
30
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst BackgroundRunner = registerPlugin('BackgroundRunner', {\n web: () => import('./web').then(m => new m.BackgroundRunnerWeb()),\n});\nexport * from './definitions';\nexport * from './apis';\nexport { BackgroundRunner };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class BackgroundRunnerWeb extends WebPlugin {\n checkPermissions() {\n throw new Error('not available on web');\n }\n requestPermissions() {\n throw new Error('not available on web');\n }\n registerBackgroundTask() {\n throw new Error('not available on web');\n }\n dispatchEvent(_options) {\n throw new Error('not available on web');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;AAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACrE,CAAC;;ACFM,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,gBAAgB,GAAG;AACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK;AACL,IAAI,kBAAkB,GAAG;AACzB,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK;AACL,IAAI,sBAAsB,GAAG;AAC7B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK;AACL,IAAI,aAAa,CAAC,QAAQ,EAAE;AAC5B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAChD,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst BackgroundRunner = registerPlugin('CapacitorBackgroundRunner', {\n web: () => import('./web').then((m) => new m.BackgroundRunnerWeb()),\n});\nexport * from './definitions';\nexport * from './apis';\nexport { BackgroundRunner };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class BackgroundRunnerWeb extends WebPlugin {\n checkPermissions() {\n throw new Error('not available on web');\n }\n requestPermissions() {\n throw new Error('not available on web');\n }\n registerBackgroundTask() {\n throw new Error('not available on web');\n }\n dispatchEvent(_options) {\n throw new Error('not available on web');\n }\n async addListener(_eventName, _listenerFunc) {\n throw new Error('not available on web');\n }\n async removeNotificationListeners() {\n throw new Error('not available on web');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,2BAA2B,EAAE;AACrE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACvE,CAAC;;ACFM,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,gBAAgB,GAAG;AACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC/C,IAAI;AACJ,IAAI,kBAAkB,GAAG;AACzB,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC/C,IAAI;AACJ,IAAI,sBAAsB,GAAG;AAC7B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC/C,IAAI;AACJ,IAAI,aAAa,CAAC,QAAQ,EAAE;AAC5B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC/C,IAAI;AACJ,IAAI,MAAM,WAAW,CAAC,UAAU,EAAE,aAAa,EAAE;AACjD,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC/C,IAAI;AACJ,IAAI,MAAM,2BAA2B,GAAG;AACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC/C,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var capacitorBackgroundRunner = (function (exports, core) {
2
2
  'use strict';
3
3
 
4
- const BackgroundRunner = core.registerPlugin('BackgroundRunner', {
5
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.BackgroundRunnerWeb()),
4
+ const BackgroundRunner = core.registerPlugin('CapacitorBackgroundRunner', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.BackgroundRunnerWeb()),
6
6
  });
7
7
 
8
8
  class BackgroundRunnerWeb extends core.WebPlugin {
@@ -18,6 +18,12 @@ var capacitorBackgroundRunner = (function (exports, core) {
18
18
  dispatchEvent(_options) {
19
19
  throw new Error('not available on web');
20
20
  }
21
+ async addListener(_eventName, _listenerFunc) {
22
+ throw new Error('not available on web');
23
+ }
24
+ async removeNotificationListeners() {
25
+ throw new Error('not available on web');
26
+ }
21
27
  }
22
28
 
23
29
  var web = /*#__PURE__*/Object.freeze({
@@ -27,8 +33,6 @@ var capacitorBackgroundRunner = (function (exports, core) {
27
33
 
28
34
  exports.BackgroundRunner = BackgroundRunner;
29
35
 
30
- Object.defineProperty(exports, '__esModule', { value: true });
31
-
32
36
  return exports;
33
37
 
34
38
  })({}, capacitorExports);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst BackgroundRunner = registerPlugin('BackgroundRunner', {\n web: () => import('./web').then(m => new m.BackgroundRunnerWeb()),\n});\nexport * from './definitions';\nexport * from './apis';\nexport { BackgroundRunner };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class BackgroundRunnerWeb extends WebPlugin {\n checkPermissions() {\n throw new Error('not available on web');\n }\n requestPermissions() {\n throw new Error('not available on web');\n }\n registerBackgroundTask() {\n throw new Error('not available on web');\n }\n dispatchEvent(_options) {\n throw new Error('not available on web');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;IAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACrE,CAAC;;ICFM,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,gBAAgB,GAAG;IACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAChD,KAAK;IACL,IAAI,kBAAkB,GAAG;IACzB,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAChD,KAAK;IACL,IAAI,sBAAsB,GAAG;IAC7B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAChD,KAAK;IACL,IAAI,aAAa,CAAC,QAAQ,EAAE;IAC5B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAChD,KAAK;IACL;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst BackgroundRunner = registerPlugin('CapacitorBackgroundRunner', {\n web: () => import('./web').then((m) => new m.BackgroundRunnerWeb()),\n});\nexport * from './definitions';\nexport * from './apis';\nexport { BackgroundRunner };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class BackgroundRunnerWeb extends WebPlugin {\n checkPermissions() {\n throw new Error('not available on web');\n }\n requestPermissions() {\n throw new Error('not available on web');\n }\n registerBackgroundTask() {\n throw new Error('not available on web');\n }\n dispatchEvent(_options) {\n throw new Error('not available on web');\n }\n async addListener(_eventName, _listenerFunc) {\n throw new Error('not available on web');\n }\n async removeNotificationListeners() {\n throw new Error('not available on web');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,2BAA2B,EAAE;IACrE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACvE,CAAC;;ICFM,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,gBAAgB,GAAG;IACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;IAC/C,IAAI;IACJ,IAAI,kBAAkB,GAAG;IACzB,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;IAC/C,IAAI;IACJ,IAAI,sBAAsB,GAAG;IAC7B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;IAC/C,IAAI;IACJ,IAAI,aAAa,CAAC,QAAQ,EAAE;IAC5B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;IAC/C,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,UAAU,EAAE,aAAa,EAAE;IACjD,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;IAC/C,IAAI;IACJ,IAAI,MAAM,2BAA2B,GAAG;IACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;IAC/C,IAAI;IACJ;;;;;;;;;;;;;;;"}