akanjs 2.2.0 → 2.2.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/capacitor.ts +19 -17
- package/package.json +1 -1
package/client/capacitor.ts
CHANGED
|
@@ -169,56 +169,58 @@ const loadCapacitorModule = <K extends keyof CapacitorModuleMap>(
|
|
|
169
169
|
return loaded;
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
const
|
|
172
|
+
const importNativeModule = <T>(specifier: string) => import(specifier) as Promise<T>;
|
|
173
|
+
|
|
174
|
+
const capacitorPackage = (name: string) => `@capacitor/${name}`;
|
|
175
|
+
|
|
176
|
+
const capacitorCommunityPackage = (name: string) => `@capacitor-community/${name}`;
|
|
173
177
|
|
|
174
178
|
export const loadCapacitorApp = () =>
|
|
175
|
-
loadCapacitorModule("app", () =>
|
|
179
|
+
loadCapacitorModule("app", () => importNativeModule<CapacitorAppModule>(capacitorPackage("app")));
|
|
176
180
|
|
|
177
181
|
export const loadCapacitorBrowser = () =>
|
|
178
|
-
loadCapacitorModule("browser", () =>
|
|
182
|
+
loadCapacitorModule("browser", () => importNativeModule<CapacitorBrowserModule>(capacitorPackage("browser")));
|
|
179
183
|
|
|
180
184
|
export const loadCapacitorCamera = () =>
|
|
181
|
-
loadCapacitorModule("camera", () =>
|
|
185
|
+
loadCapacitorModule("camera", () => importNativeModule<CapacitorCameraModule>(capacitorPackage("camera")));
|
|
182
186
|
|
|
183
187
|
export const loadCapacitorContacts = () =>
|
|
184
188
|
loadCapacitorModule("contacts", () =>
|
|
185
|
-
|
|
189
|
+
importNativeModule<CapacitorContactsModule>(capacitorCommunityPackage("contacts")),
|
|
186
190
|
);
|
|
187
191
|
|
|
188
192
|
export const loadCapacitorCore = () =>
|
|
189
|
-
loadCapacitorModule("core", () =>
|
|
193
|
+
loadCapacitorModule("core", () => importNativeModule<CapacitorCoreModule>(capacitorPackage("core")));
|
|
190
194
|
|
|
191
195
|
export const loadCapacitorDevice = () =>
|
|
192
|
-
loadCapacitorModule("device", () =>
|
|
196
|
+
loadCapacitorModule("device", () => importNativeModule<CapacitorDeviceModule>(capacitorPackage("device")));
|
|
193
197
|
|
|
194
198
|
export const loadCapacitorFcm = () =>
|
|
195
|
-
loadCapacitorModule("fcm", () =>
|
|
199
|
+
loadCapacitorModule("fcm", () => importNativeModule<CapacitorFcmModule>(capacitorCommunityPackage("fcm")));
|
|
196
200
|
|
|
197
201
|
export const loadCapacitorGeolocation = () =>
|
|
198
202
|
loadCapacitorModule("geolocation", () =>
|
|
199
|
-
|
|
203
|
+
importNativeModule<CapacitorGeolocationModule>(capacitorPackage("geolocation")),
|
|
200
204
|
);
|
|
201
205
|
|
|
202
206
|
export const loadCapacitorHaptics = () =>
|
|
203
|
-
loadCapacitorModule("haptics", () =>
|
|
207
|
+
loadCapacitorModule("haptics", () => importNativeModule<CapacitorHapticsModule>(capacitorPackage("haptics")));
|
|
204
208
|
|
|
205
209
|
export const loadCapacitorKeyboard = () =>
|
|
206
|
-
loadCapacitorModule("keyboard", () =>
|
|
210
|
+
loadCapacitorModule("keyboard", () => importNativeModule<CapacitorKeyboardModule>(capacitorPackage("keyboard")));
|
|
207
211
|
|
|
208
212
|
export const loadCapacitorPreferences = () =>
|
|
209
213
|
loadCapacitorModule("preferences", () =>
|
|
210
|
-
|
|
214
|
+
importNativeModule<CapacitorPreferencesModule>(capacitorPackage("preferences")),
|
|
211
215
|
);
|
|
212
216
|
|
|
213
217
|
export const loadCapacitorPushNotifications = () =>
|
|
214
218
|
loadCapacitorModule("pushNotifications", () =>
|
|
215
|
-
|
|
219
|
+
importNativeModule<CapacitorPushNotificationsModule>(capacitorPackage("push-notifications")),
|
|
216
220
|
);
|
|
217
221
|
|
|
218
222
|
export const loadCapacitorSafeArea = () =>
|
|
219
|
-
loadCapacitorModule("safeArea", () =>
|
|
220
|
-
asCapacitorModule<CapacitorSafeAreaModule>(import("capacitor-plugin-safe-area")),
|
|
221
|
-
);
|
|
223
|
+
loadCapacitorModule("safeArea", () => importNativeModule<CapacitorSafeAreaModule>("capacitor-plugin-safe-area"));
|
|
222
224
|
|
|
223
225
|
export const loadCapacitorUpdater = () =>
|
|
224
|
-
loadCapacitorModule("updater", () =>
|
|
226
|
+
loadCapacitorModule("updater", () => importNativeModule<CapacitorUpdaterModule>("@capgo/capacitor-updater"));
|