|
| 1 | +# Overview |
| 2 | + |
| 3 | +Super Capacitor is a Capacitor plugin designed to allow Capacitor apps to utilize the capabilities of Ionic Portals. |
| 4 | + |
| 5 | +## Install |
| 6 | + |
| 7 | +```bash |
| 8 | +npm install @ionic-enterprise/super-capacitor |
| 9 | +npx cap sync |
| 10 | +``` |
| 11 | + |
| 12 | +## Types |
| 13 | + |
| 14 | +### PortalOptions |
| 15 | + |
| 16 | +The options for configuring your portal when using [`presentPortal`](#presentportal). |
| 17 | + |
| 18 | +```typescript |
| 19 | +interface PortalOptions { |
| 20 | + name: string; |
| 21 | + startDir?: string; |
| 22 | + initialContext?: InitialContext; |
| 23 | + plugins?: CapacitorPlugin[]; |
| 24 | + liveUpdateConfig?: LiveUpdateConfig; |
| 25 | + type: 'push' | 'modal'; |
| 26 | + modalStyle?: 'fullscreen' | 'sheet'; |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +### CapacitorPlugin |
| 31 | + |
| 32 | +If you need to use any Capacitor plugins, the classpath of the Android plugins and the Objective-C class name will have to be provided to [`PortalOptions`](#portaloptions) in the `plugins` property. |
| 33 | + |
| 34 | +```typescript |
| 35 | +interface CapacitorPlugin { |
| 36 | + /** The classpath of the plugin to be used in Android. (e.g. com.capacitorjs.plugins.camera.CameraPlugin) */ |
| 37 | + androidClassPath: string; |
| 38 | + /** The class name of the plugin to be used in iOS. |
| 39 | + * This must be the name as it is exposed to the Objective-C runtime. |
| 40 | + * For example, The CameraPlugin swift class is exposed to Objective-C as CAPCameraPlugin. |
| 41 | + */ |
| 42 | + iosClassName: string; |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +## Methods |
| 47 | + |
| 48 | +- [`presentPortal(options: PortalOptions)`](#presentportal) |
| 49 | +- [`dismissPortal()`](#dismissportal) |
| 50 | + |
| 51 | +### presentPortal |
| 52 | + |
| 53 | +```typescript |
| 54 | +presentPortal(options: PortalOptions) => Promise<void> |
| 55 | +``` |
| 56 | + |
| 57 | +#### Usage |
| 58 | + |
| 59 | +```typescript |
| 60 | +import { presentPortal } from '@ionic-enterprise/super-capacitor/superapp'; |
| 61 | + |
| 62 | +presentPortal({ name: 'checkoutApp', startDir: 'portals/checkout', type: 'push' }); |
| 63 | +``` |
| 64 | + |
| 65 | +#### Parameters |
| 66 | + |
| 67 | +| Name | Type | Description | |
| 68 | +| --------- | ------------------------------- | ------------------------------------------------------------------- | |
| 69 | +| `options` | [`PortalOptions`](#portaloptions) | The [`PortalOptions`](#portaloptions) object to configure the portal. | |
| 70 | + |
| 71 | +### dismissPortal |
| 72 | + |
| 73 | +```typescript |
| 74 | +dismissPortal() => Promise<void> |
| 75 | +``` |
| 76 | + |
| 77 | +#### Usage |
| 78 | + |
| 79 | +```typescript |
| 80 | +import { dismissPortal } from '@ionic-enterprise/super-capacitor/miniapp'; |
| 81 | + |
| 82 | +dismissPortal(); |
| 83 | +``` |
0 commit comments