Skip to content

Commit

Permalink
feat(all): add optional result parameter to done callback (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
elbkind committed Jan 31, 2022
1 parent 64a6f32 commit 86feace
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions packages/core/src/feature-app-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ export interface FeatureAppEnvironment<
* If this callback is defined, a short-lived Feature App can call this
* function when it has completed its task. The Integrator (or parent Feature
* App) can then decide to e.g. unmount the Feature App.
*
* Optionally, the Feature App can pass a result into the done callback. The
* type/structure of the result must be agreed between the Integrator (or
* parent Feature App) and the Feature App.
*/
readonly done?: () => void;
readonly done?: (result?: unknown) => void;
}

export interface FeatureAppDefinition<
Expand Down Expand Up @@ -118,8 +122,12 @@ export interface FeatureAppScopeOptions<
* short-lived Feature App can call this function when it has completed its
* task. The Integrator (or parent Feature App) can then decide to e.g.
* unmount the Feature App.
*
* Optionally, the Feature App can pass a result into the done callback. The
* type/structure of the result must be agreed between the Integrator (or
* parent Feature App) and the Feature App.
*/
readonly done?: () => void;
readonly done?: (result?: unknown) => void;
}

export interface FeatureAppManagerOptions {
Expand Down
6 changes: 5 additions & 1 deletion packages/react/src/feature-app-loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ export interface FeatureAppLoaderProps<TConfig = unknown> {
* short-lived Feature App can call this function when it has completed its
* task. The Integrator (or parent Feature App) can then decide to e.g.
* unmount the Feature App.
*
* Optionally, the Feature App can pass a result into the done callback. The
* type/structure of the result must be agreed between the Integrator (or
* parent Feature App) and the Feature App.
*/
readonly done?: () => void;
readonly done?: (result?: unknown) => void;

readonly onError?: (error: Error) => void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ export interface BaseFeatureAppContainerProps<
* short-lived Feature App can call this function when it has completed its
* task. The Integrator (or parent Feature App) can then decide to e.g.
* unmount the Feature App.
*
* Optionally, the Feature App can pass a result into the done callback. The
* type/structure of the result must be agreed between the Integrator (or
* parent Feature App) and the Feature App.
*/
readonly done?: () => void;
readonly done?: (result?: unknown) => void;

readonly onError?: (error: Error) => void;

Expand Down

0 comments on commit 86feace

Please sign in to comment.