-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(platform): add convenience API to reduce code required to respon…
…d to requests This commits adds the methods `onMessage` to the 'MessageClient` and `onIntent` to the `IntentClient`. Unlike `observe$`, messages are passed to a callback function rather than emitted from an Observable. Response(s) can be returned directly from the callback. It supports error propagation and request termination. Using this method over `observe$` significantly reduces the code required to respond to requests. closes #43 BREAKING CHANGE: Adding the convenience API for responding to requests introduced the following breaking change for Angular projects. > Note: The messaging protocol between the host and client HAS NOT CHANGED. Thus, you can upgrade the host and clients to the new version independently. To migrate: - If an Angular project, add the method `onMessage` to your NgZone message client decorator, as following: ```typescript public onMessage<IN = any, OUT = any>(topic: string, onMessage: (message: TopicMessage<IN>) => Observable<OUT> | Promise<OUT> | OUT | void): Subscription { return messageClient.onMessage(topic, onMessage); } ``` See https://scion-microfrontend-platform-developer-guide.now.sh/#chapter:angular-integration-guide:preparing-messaging-for-use-with-angular for more information. - If an Angular project, add the method `onIntent` to your NgZone intent client decorator, as following: ```typescript public onIntent<IN = any, OUT = any>(selector: IntentSelector, onIntent: (intentMessage: IntentMessage<IN>) => Observable<OUT> | Promise<OUT> | OUT | void): Subscription { return intentClient.onIntent(selector, onIntent); } ``` See https://scion-microfrontend-platform-developer-guide.now.sh/#chapter:angular-integration-guide:preparing-messaging-for-use-with-angular for more information.
- Loading branch information
1 parent
77a4dd9
commit d0eeaf5
Showing
18 changed files
with
1,512 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.