MCPcopy
hub / github.com/ionic-team/capacitor / isPluginAvailable

Function isPluginAvailable

core/src/runtime.ts:27–41  ·  view source on GitHub ↗
(pluginName: string)

Source from the content-addressed store, hash-verified

25 const isNativePlatform = () => getPlatform() !== 'web';
26
27 const isPluginAvailable = (pluginName: string): boolean => {
28 const plugin = registeredPlugins.get(pluginName);
29
30 if (plugin?.platforms.has(getPlatform())) {
31 // JS implementation available for the current platform.
32 return true;
33 }
34
35 if (getPluginHeader(pluginName)) {
36 // Native implementation available.
37 return true;
38 }
39
40 return false;
41 };
42
43 const getPluginHeader = (pluginName: string): PluginHeader | undefined =>
44 cap.PluginHeaders?.find((h) => h.name === pluginName);

Callers

nothing calls this directly

Calls 3

getPluginHeaderFunction · 0.85
getPlatformFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected