async function register()

in src/widgets/markdown/app.tsx [14:33]


    async function register() {
      // Register widget in YouTrack. To learn more, see https://www.jetbrains.com/help/youtrack/devportal-apps/apps-host-api.html
      const newHost = await YTApp.register({
        onConfigure: () => setIsConfiguring(true)
      });

      if (!('readConfig' in newHost)) {
        throw new Error('Wrong type of API returned: probably widget used in wrong extension point');
      }

      setHost(newHost);

      const configValue = await newHost.readConfig<WidgetConfiguration>();
      if (!configValue?.someValue) {
        newHost.enterConfigMode();
        setIsConfiguring(true);
      } else {
        setConfig(configValue);
      }
    }