@appzung/react-native-code-push
Version:
React Native plugin for the CodePush service
24 lines (23 loc) • 1.17 kB
JavaScript
import { NativeRNAppZungCodePushModule } from "./NativeRNAppZungCodePushModule.js";
export class LocalPackageImplementation {
constructor(localPackageData) {
Object.assign(this, localPackageData);
this.install = async (installMode = NativeRNAppZungCodePushModule.getConstants().codePushInstallModeOnNextRestart, minimumBackgroundDuration = 0, updateInstalledCallback) => {
const {
...localPackageCopy
} = localPackageData;
await NativeRNAppZungCodePushModule.installUpdate(localPackageCopy, installMode, minimumBackgroundDuration);
if (installMode === NativeRNAppZungCodePushModule.getConstants().codePushInstallModeImmediate) {
await updateInstalledCallback?.();
await NativeRNAppZungCodePushModule.restartApp(false);
return;
}
await NativeRNAppZungCodePushModule.clearPendingRestart();
this.isPending = true; // Mark the package as pending since it hasn't been applied yet
await updateInstalledCallback?.();
};
}
isPending = false; // A local package wouldn't be pending until it was installed
}
//# sourceMappingURL=LocalPackageImplementation.js.map
;