Skip to content

Commit d59554c

Browse files
authored
Merge pull request #70 from Soomgo-Mobile/fix-on-update-success-not-a-function
fix(Runtime): ensure callbacks are called safely
2 parents 5efbdde + 4a5aa1d commit d59554c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CodePush.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ async function tryReportStatus(statusReport, retryOnAppResume) {
253253
const label = statusReport.package.label;
254254
if (statusReport.status === "DeploymentSucceeded") {
255255
log(`Reporting CodePush update success (${label})`);
256-
sharedCodePushOptions?.onUpdateSuccess(label);
256+
sharedCodePushOptions?.onUpdateSuccess?.(label);
257257
} else {
258258
log(`Reporting CodePush update rollback (${label})`);
259259
await NativeCodePush.setLatestRollbackInfo(statusReport.package.packageHash);
260-
sharedCodePushOptions?.onUpdateRollback(label);
260+
sharedCodePushOptions?.onUpdateRollback?.(label);
261261
}
262262
}
263263

@@ -564,7 +564,7 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
564564
}
565565
} catch (error) {
566566
syncStatusChangeCallback(CodePush.SyncStatus.UNKNOWN_ERROR);
567-
sharedCodePushOptions?.onSyncError(remotePackageLabel ?? 'unknown', error);
567+
sharedCodePushOptions?.onSyncError?.(remotePackageLabel ?? 'unknown', error);
568568
log(error.message);
569569
throw error;
570570
}

0 commit comments

Comments
 (0)