ComPDFKit Web SDK
    Preparing search index...

    Function importModularComponents

    • Replaces the modular UI (components, headers, panels, flyouts and popups) with imported data. Everything is validated first (unknown types, missing item references, header placement, panel location / render); any invalid item rejects the Promise and leaves the UI unchanged. Functions in the data are names looked up in functionMap. Items marked disabled are disabled as with disableElements. UI.Events.MODULAR_UI_IMPORTED is triggered when done.

      Parameters

      • data: ModularComponentsData

        The data, as returned by exportModularComponents.

      • OptionalfunctionMap: { [x: string]: (...args: any[]) => unknown }

        Functions referenced by name in the data.

      Returns Promise<void>

      A Promise that resolves once the data is applied.

      const response = await fetch('/config/modular-ui.json');
      await instance.UI.importModularComponents(await response.json(), {
      saveToServer: () => console.log('save'), // referenced as "onClick": "saveToServer" in the JSON
      });