@aparajita/capacitor-native-decorator
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "@aparajita/capacitor-native-decorator", | ||
"version": "3.0.0" | ||
"version": "3.0.1" | ||
} |
@@ -9,3 +9,3 @@ 'use strict'; | ||
name: "@aparajita/capacitor-native-decorator", | ||
version: "3.0.0" | ||
version: "3.0.1" | ||
}; | ||
@@ -12,0 +12,0 @@ |
@@ -6,3 +6,3 @@ var capacitorNativeDecorator = (function (exports, core) { | ||
name: "@aparajita/capacitor-native-decorator", | ||
version: "3.0.0" | ||
version: "3.0.1" | ||
}; | ||
@@ -9,0 +9,0 @@ |
{ | ||
"name": "@aparajita/capacitor-native-decorator", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Decorator for Capacitor plugins that allows painless TypeScript<->native integration", | ||
@@ -32,3 +32,2 @@ "keywords": [ | ||
"concurrent": [ | ||
"lint", | ||
"tsc" | ||
@@ -77,19 +76,16 @@ ] | ||
"scripts": { | ||
"clean": "rimraf dist", | ||
"extract-info": "node scripts/extractPackageInfo.js", | ||
"lint.eslint": "eslint --cache --ext .js,.cjs,.mjs,.ts --max-warnings 0", | ||
"lint.prettier": "prettier --cache --list-different", | ||
"lint.eslint": "eslint --fix --cache --ext .js,.cjs,.mjs,.ts --max-warnings 0", | ||
"lint.prettier": "prettier --write --cache --list-different", | ||
"lint.tsc": "tsc --noEmit", | ||
"prelint": "pnpm -s extract-info", | ||
"prelint.fix": "pnpm -s extract-info", | ||
"lint": "pnpm -s lint.eslint . && pnpm -s lint.prettier . && pnpm -s lint.tsc", | ||
"lint.fix": "pnpm -s lint.eslint --fix . && pnpm -s lint.prettier --write . && pnpm -s lint.tsc", | ||
"lint": "pnpm -s extract-info && pnpm -s lint.eslint . && pnpm -s lint.prettier . && pnpm -s lint.tsc", | ||
"tsc": "tsc ${SOURCE_MAP} && tsc --build tsconfig-cli.json", | ||
"builder": "rimraf dist && pnpm -s tsc && rollup -c rollup.config.mjs", | ||
"builder": "pnpm -s extract-info && pnpm -s clean && pnpm -s tsc && rollup -c rollup.config.mjs", | ||
"build": "pnpm -s builder", | ||
"build.dev": "SOURCE_MAP=--sourceMap pnpm -s builder", | ||
"watch": "nodemon --exec 'pnpm -s build.dev'", | ||
"prerelease": "scripts/ensure-clean.sh && pnpm -s lint.fix", | ||
"release": "commit-and-tag-version", | ||
"release.publish": "pnpm -s release && git push --follow-tags && pnpm publish" | ||
"release.pre": "scripts/ensure-clean.sh && pnpm -s lint", | ||
"release": "pnpm -s release.pre && commit-and-tag-version && git push --follow-tags && pnpm publish" | ||
} | ||
} |
@@ -55,3 +55,3 @@ <div class="markdown-body"> | ||
export interface AwesomePlugin extends DecoratedNativePlugin { | ||
getStorageCount: () => Promise<number> | ||
getStorageCount: () => number | ||
setItem: (key: string, data: string | number) => Promise<void> | ||
@@ -74,4 +74,5 @@ getItem: (key: string) => Promise<string> | ||
// This is usable even on native platforms! | ||
getStorageCount(): Promise<number> { | ||
return Promise.resolve(this._storageCount) | ||
// And notice it does not have to be async. | ||
getStorageCount(): number { | ||
return this._storageCount | ||
} | ||
@@ -205,3 +206,3 @@ | ||
await Awesome.setItem('count', count) | ||
console.log(`${await Awesome.getStorageCount()} item(s) stored`) | ||
console.log(`${Awesome.getStorageCount()} item(s) stored`) | ||
} | ||
@@ -317,3 +318,3 @@ | ||
const awesome = registerPlugin<AwesomePlugin>('Awesome', { | ||
registerPlugin<AwesomePlugin>('Awesome', { | ||
web: plugin, | ||
@@ -324,4 +325,6 @@ ios: plugin, | ||
// We do NOT export the result of registerPlugin, because that would | ||
// circumvent the magic the @native decorator does. | ||
export * from './definitions' | ||
export { awesome as Awesome } | ||
export { plugin as Awesome } | ||
``` | ||
@@ -357,3 +360,3 @@ | ||
// ===> You need to add this <=== | ||
// ===> 👇🏼You need to add this <=== | ||
'@aparajita/capacitor-native-decorator': 'capacitorNativeDecorator' | ||
@@ -373,6 +376,6 @@ // =============================== | ||
// ===> You need to add the second item here <=== | ||
// ===> You need to add the second item here 👇 <=== | ||
external: ['@capacitor/core', '@aparajita/capacitor-native-decorator'], | ||
// ===> You need to add this <=== | ||
// ===> 👇🏼You need to add this <=== | ||
context: 'window' | ||
@@ -398,3 +401,3 @@ } | ||
> **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. | ||
> **NOTE:** Plugin class methods that are not marked as `@native` do NOT have to return a Promise. | ||
@@ -401,0 +404,0 @@ #### 6. Call `make-ios-plugin` in the `build` script |
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
417
42403