Skip to content

Commit

Permalink
fix: Make isPluginAvailable available on bridge (#4589)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored May 19, 2021
1 parent 357fcb5 commit 151e7a8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions android/capacitor/src/main/assets/native-bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ const nativeBridge = (function (exports) {
const isNativePlatform = () => true;
const getPlatform = () => getPlatformId(win);
cap.getPlatform = getPlatform;
cap.isPluginAvailable = name => Object.prototype.hasOwnProperty.call(cap.Plugins, name);
cap.isNativePlatform = isNativePlatform;
// create the postToNative() fn if needed
if (getPlatformId(win) === 'android') {
Expand Down
2 changes: 2 additions & 0 deletions core/native-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ const initBridge = (w: any): void => {
const getPlatform = () => getPlatformId(win);

cap.getPlatform = getPlatform;
cap.isPluginAvailable = name =>
Object.prototype.hasOwnProperty.call(cap.Plugins, name);
cap.isNativePlatform = isNativePlatform;

// create the postToNative() fn if needed
Expand Down
1 change: 1 addition & 0 deletions ios/Capacitor/Capacitor/assets/native-bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ const nativeBridge = (function (exports) {
const isNativePlatform = () => true;
const getPlatform = () => getPlatformId(win);
cap.getPlatform = getPlatform;
cap.isPluginAvailable = name => Object.prototype.hasOwnProperty.call(cap.Plugins, name);
cap.isNativePlatform = isNativePlatform;
// create the postToNative() fn if needed
if (getPlatformId(win) === 'android') {
Expand Down

0 comments on commit 151e7a8

Please sign in to comment.