Skip to content

Commit

Permalink
Merge branch 'main' into generate-plugins-object-native
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Apr 27, 2021
2 parents f12635e + febd606 commit 03db2e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Made possible by the Capacitor community. 💖
<!-- CONTRIBUTORS:START -->

<p align="center">
<a href="https://github.com/XiaNi"><img src="https://github.com/XiaNi.png?size=100" width="50" height="50" /></a>
<a href="https://github.com/timbru31"><img src="https://github.com/timbru31.png?size=100" width="50" height="50" /></a>
<a href="https://github.com/theproducer"><img src="https://github.com/theproducer.png?size=100" width="50" height="50" /></a>
<a href="https://github.com/thomasvidas"><img src="https://github.com/thomasvidas.png?size=100" width="50" height="50" /></a>
Expand Down
11 changes: 6 additions & 5 deletions core/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,8 @@ export const createCapacitor = (win: WindowCapacitor): CapacitorInstance => {
impl: any,
prop: PropertyKey,
): ((...args: any[]) => any) => {
if (impl) {
return impl[prop]?.bind(impl);
} else if (pluginHeader) {
const methodHeader = pluginHeader.methods.find(m => prop === m.name);

if (pluginHeader) {
const methodHeader = pluginHeader?.methods.find(m => prop === m.name);
if (methodHeader) {
if (methodHeader.rtype === 'promise') {
return (options: any) =>
Expand All @@ -134,7 +131,11 @@ export const createCapacitor = (win: WindowCapacitor): CapacitorInstance => {
callback,
);
}
} else if (impl) {
return impl[prop]?.bind(impl);
}
} else if (impl) {
return impl[prop]?.bind(impl);
} else {
throw new CapacitorException(
`"${pluginName}" plugin is not implemented on ${platform}`,
Expand Down

0 comments on commit 03db2e5

Please sign in to comment.