Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: provide information how to build a partly native plugin #83

Open
MasonVX opened this issue Sep 30, 2022 · 1 comment
Open

docs: provide information how to build a partly native plugin #83

MasonVX opened this issue Sep 30, 2022 · 1 comment

Comments

@MasonVX
Copy link

MasonVX commented Sep 30, 2022

Bachground:
There are some things within the SDKs of Android and iOS and also the capabilities of the Webviews which make it necessary to implement a plugin for one platform und use the web version for the other.

e.g. iOS has a great PDFKit SDK and and the same time a bad pdf implementation in the Webview (yes, pdf.js is not very great as well, some edge cases are not working at all and the performance is bad)
Android is good enough with the build in viewer.

Propose:
Document how to create such plugins.
You have to include the web part in the index.ts

const CustomPlugin = registerPlugin< CustomPlugin >('Custom', {
  android: () => import('./web').then(m => new m.CustomWeb()),
  web: () => import('./web').then(m => new m.CustomWeb()),
});

And in this case remove android from the capacitor property of the package.json

@eric-horodyski
Copy link
Member

Hey @MasonVX,

Where would you feel this documentation would be appropriate? In my mind, I feel that snippet of information fits best in the Registering the Web Implementation portion of the Capacitor Plugin Tutorial (link).

If you agree, I invite you to contribute by editing this file: https://github.com/ionic-team/capacitor-docs/blob/main/docs/plugins/tutorial/implementing-for-web.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants