onOpen Static Readonly

onOpen: BeEvent<(_args: OpenBriefcaseArgs) => void> = ...

Event raised just before a BriefcaseDb is opened. Supplies the arguments that will be used to open the BriefcaseDb. Throw an exception to stop the open.

Example:

BriefcaseDb.onOpen.addListener((briefcaseProps: OpenBriefcaseProps) => {
  // A read-only application might want to reject all requests to open an iModel for writing. It can do this in the onOpen event.
  if (!briefcaseProps.readonly)
    throw new IModelError(IModelStatus.BadRequest, "This app is readonly");
});

Defined in

Last Updated: 14 November, 2024