How to use @scion/microfrontend-platform - 10 common examples

To help you get started, we’ve selected a few @scion/microfrontend-platform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / testing-app.component.ts View on Github external
public ngOnDestroy(): void {
    MicrofrontendPlatform.destroy().then(); // Platform is started in {@link TestingAppPlatformInitializerResolver}
  }
}
github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / manifest / manifest-request-handler.ts View on Github external
private publishInstalledApplications(): void {
    const applications: Application[] = Beans.get(ApplicationRegistry).getApplications();
    Beans.get(MessageClient).publish$(Topics.Applications, applications, {retain: true}).subscribe();
  }
github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / manifest / manifest-request-handler.ts View on Github external
private installCapabilityUnregisterRequestHandler(): void {
    Beans.get(MessageClient).observe$(Topics.UnregisterCapability)
      .pipe(takeUntil(this._destroy$))
      .subscribe((request: TopicMessage) => {
        const appSymbolicName = request.headers.get(MessageHeaders.AppSymbolicName);
        Beans.get(ManifestRegistry).unregisterCapability(appSymbolicName, request.body.capabilityId);
      });
  }
github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / testing-app-platform-initializer.resolver.ts View on Github external
private startHostPlatform(port: number): Promise {
    Beans.get(PlatformState).whenState(PlatformStates.Starting).then(() => {
      Beans.register(NgZone, {useValue: this._zone});
      Beans.registerDecorator(MessageClient, {useClass: AngularZoneMessageClientDecorator});
      Beans.registerDecorator(PlatformMessageClient, {useClass: AngularZoneMessageClientDecorator});
    });

    return MicrofrontendPlatform.forHost([
      {manifestUrl: 'http://localhost:4200/testing-app/assets/app-4200-manifest.json', symbolicName: 'app-4200'},
      {manifestUrl: 'http://localhost:4201/testing-app/assets/app-4201-manifest.json', symbolicName: 'app-4201'},
      {manifestUrl: 'http://localhost:4202/testing-app/assets/app-4202-manifest.json', symbolicName: 'app-4202'},
      {manifestUrl: 'http://localhost:4203/testing-app/assets/app-4203-manifest.json', symbolicName: 'app-4203'},
    ], {symbolicName: `app-${port}`});
  }
github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / manifest / manifest-request-handler.ts View on Github external
.pipe(mergeMap((request: TopicMessage) => {
          const manifestRegistry = Beans.get(ManifestRegistry);
          const replyTo = request.headers.get(MessageHeaders.ReplyTo);
          const appSymbolicName = request.headers.get(MessageHeaders.AppSymbolicName);

          return merge(of(null), manifestRegistry.intentChange$)
            .pipe(
              map(() => manifestRegistry.getIntentsByApplication(appSymbolicName)),
              switchMap(intents => Beans.get(MessageClient).publish$(replyTo, intents)),
              takeUntilUnsubscribe(replyTo),
            );
        }),
        takeUntil(this._destroy$),
github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / manifest / manage-capabilities / manage-capabilities.component.ts View on Github external
public onCapabilityUnregister(capability: Provider): void {
    const unregisterCommand: ProviderUnregisterCommand = {type: capability.type, qualifier: capability.qualifier};
    Beans.get(MessageClient).publish$(Topics.UnregisterProvider, unregisterCommand).subscribe();
  }
}
github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / manifest / manage-capabilities / manage-capabilities.component.ts View on Github external
public onCapabilityRegister(): void {
    const registerCommand: ProviderRegisterCommand = {
      provider: {
        type: this.form.get(TYPE).value,
        qualifier: SciParamsEnterComponent.toParams(this.form.get(QUALIFIER) as FormArray),
        private: this.form.get(PRIVATE).value,
      },
    };
    Beans.get(MessageClient).publish$(Topics.RegisterProvider, registerCommand).subscribe();
  }
github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / manifest / manifest-request-handler.ts View on Github external
private installCapabilityRegisterRequestHandler(): void {
    Beans.get(MessageClient).observe$(Topics.RegisterCapability)
      .pipe(takeUntil(this._destroy$))
      .subscribe((request: TopicMessage) => {
        const appSymbolicName = request.headers.get(MessageHeaders.AppSymbolicName);
        Beans.get(ManifestRegistry).registerCapability(appSymbolicName, [request.body.capability]);
      });
  }
github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / testing-app-platform-initializer.resolver.ts View on Github external
private startClientPlatform(port: number): Promise {
    Beans.get(PlatformState).whenState(PlatformStates.Starting).then(() => {
      Beans.register(NgZone, {useValue: this._zone});
      Beans.registerDecorator(MessageClient, {useClass: AngularZoneMessageClientDecorator});
    });

    return MicrofrontendPlatform.forClient({symbolicName: `app-${port}`});
  }
}
github SchweizerischeBundesbahnen / scion-workbench / apps / microfrontend-apps / src / testing-app / manifest / manifest-request-handler.ts View on Github external
private installCapabilitiesQueryRequestHandler(): void {
    Beans.get(MessageClient).observe$(Topics.Capabilities)
      .pipe(
        mergeMap((request: TopicMessage) => {
          const manifestRegistry = Beans.get(ManifestRegistry);
          const replyTo = request.headers.get(MessageHeaders.ReplyTo);
          const appSymbolicName = request.headers.get(MessageHeaders.AppSymbolicName);

          return merge(of(null), manifestRegistry.capabilityChange$)
            .pipe(
              map(() => manifestRegistry.getCapabilitiesByApplication(appSymbolicName)),
              switchMap(capabilities => Beans.get(MessageClient).publish$(replyTo, capabilities)),
              takeUntilUnsubscribe(replyTo),
            );
        }),
        takeUntil(this._destroy$),
      )
      .subscribe();