@aparajita/capacitor-native-decorator
Advanced tools
Comparing version 2.0.5 to 2.0.6
@@ -5,3 +5,3 @@ import type { PluginResultError } from '@capacitor/core'; | ||
*/ | ||
export declare type CallOptions = Record<string, never>; | ||
export declare type CallOptions = Record<string, unknown>; | ||
/** | ||
@@ -17,4 +17,17 @@ * Capacitor plugins may also return an error code. | ||
export declare enum PluginReturnType { | ||
/** | ||
* The plugin call returns no data **and** will never reject. | ||
* If you return no data but might reject, use `PluginReturnType.promise`, | ||
* otherwise the promise on the TypeScript side will not reject. | ||
*/ | ||
none = 0, | ||
/** | ||
* The plugin call returns data and/or it might reject. | ||
*/ | ||
promise = 1, | ||
/** | ||
* The plugin call is passing a callback to be called repeatedly. | ||
* The native plugin will mark the call `keepAlive` and will | ||
* repeatedly resolve. | ||
*/ | ||
callback = 2 | ||
@@ -21,0 +34,0 @@ } |
@@ -6,5 +6,18 @@ /** | ||
(function (PluginReturnType) { | ||
/** | ||
* The plugin call returns no data **and** will never reject. | ||
* If you return no data but might reject, use `PluginReturnType.promise`, | ||
* otherwise the promise on the TypeScript side will not reject. | ||
*/ | ||
PluginReturnType[PluginReturnType["none"] = 0] = "none"; | ||
/** | ||
* The plugin call returns data and/or it might reject. | ||
*/ | ||
PluginReturnType[PluginReturnType["promise"] = 1] = "promise"; | ||
/** | ||
* The plugin call is passing a callback to be called repeatedly. | ||
* The native plugin will mark the call `keepAlive` and will | ||
* repeatedly resolve. | ||
*/ | ||
PluginReturnType[PluginReturnType["callback"] = 2] = "callback"; | ||
})(PluginReturnType || (PluginReturnType = {})); |
{ | ||
"name": "@aparajita/capacitor-native-decorator", | ||
"version": "2.0.3", | ||
"version": "2.0.5", | ||
"description": "Decorator for Capacitor plugins that allows painless TypeScript<->native integration", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -14,4 +14,17 @@ 'use strict'; | ||
(function (PluginReturnType) { | ||
/** | ||
* The plugin call returns no data **and** will never reject. | ||
* If you return no data but might reject, use `PluginReturnType.promise`, | ||
* otherwise the promise on the TypeScript side will not reject. | ||
*/ | ||
PluginReturnType[PluginReturnType["none"] = 0] = "none"; | ||
/** | ||
* The plugin call returns data and/or it might reject. | ||
*/ | ||
PluginReturnType[PluginReturnType["promise"] = 1] = "promise"; | ||
/** | ||
* The plugin call is passing a callback to be called repeatedly. | ||
* The native plugin will mark the call `keepAlive` and will | ||
* repeatedly resolve. | ||
*/ | ||
PluginReturnType[PluginReturnType["callback"] = 2] = "callback"; | ||
@@ -18,0 +31,0 @@ })(exports.PluginReturnType || (exports.PluginReturnType = {})); |
@@ -11,4 +11,17 @@ var capacitorNativeDecorator = (function (exports, core) { | ||
(function (PluginReturnType) { | ||
/** | ||
* The plugin call returns no data **and** will never reject. | ||
* If you return no data but might reject, use `PluginReturnType.promise`, | ||
* otherwise the promise on the TypeScript side will not reject. | ||
*/ | ||
PluginReturnType[PluginReturnType["none"] = 0] = "none"; | ||
/** | ||
* The plugin call returns data and/or it might reject. | ||
*/ | ||
PluginReturnType[PluginReturnType["promise"] = 1] = "promise"; | ||
/** | ||
* The plugin call is passing a callback to be called repeatedly. | ||
* The native plugin will mark the call `keepAlive` and will | ||
* repeatedly resolve. | ||
*/ | ||
PluginReturnType[PluginReturnType["callback"] = 2] = "callback"; | ||
@@ -15,0 +28,0 @@ })(exports.PluginReturnType || (exports.PluginReturnType = {})); |
{ | ||
"name": "@aparajita/capacitor-native-decorator", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "Decorator for Capacitor plugins that allows painless TypeScript<->native integration", | ||
@@ -75,5 +75,5 @@ "keywords": [ | ||
"push": "git push --follow-tags origin main", | ||
"release.check": "commit-and-tag-version ${VERSION:+-r $VERSION} --dry-run", | ||
"release.check": "pnpm check && commit-and-tag-version ${VERSION:+-r $VERSION} --dry-run", | ||
"release": "commit-and-tag-version ${VERSION:+-r $VERSION} && pnpm push && pnpm publish" | ||
} | ||
} |
@@ -375,13 +375,4 @@ <div class="markdown-body"> | ||
#### 5. Call `make-ios-plugin` in the `build` script | ||
#### 5. Add `@native() ` to your native methods | ||
Somewhere in your `package.json` scripts, you will want to call `make-ios-plugin` to automatically create the `Plugin.m` file for iOS. For example: | ||
``` | ||
"build": "pnpm run clean && tsc && rollup -c rollup.config.js && pnpm make" | ||
"make": "make-ios-plugin" | ||
``` | ||
#### 6. Add `@native() ` to your native methods | ||
Import the `native` decorator function: | ||
@@ -401,4 +392,13 @@ | ||
Note that **all** methods declared in your plugin interface must return a promise, even if they are not decorated with `@native()`. | ||
> **IMPORTANT:** Any plugin class method that will be called in a native context **must** return a Promise, even if it is not decorated with `@native()`. If a method will **only** be used on the web, it does not need to return a Promise. | ||
#### 6. Call `make-ios-plugin` in the `build` script | ||
Somewhere in your `package.json` scripts, you will want to call `make-ios-plugin` to automatically create the `Plugin.m` file for iOS. For example: | ||
``` | ||
"build": "pnpm run clean && tsc && rollup -c rollup.config.js && pnpm make" | ||
"make": "make-ios-plugin" | ||
``` | ||
## Example | ||
@@ -405,0 +405,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45254
534