Skip to content

Commit

Permalink
feat: Added ExternalScope type.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnasyrov committed Aug 27, 2022
1 parent b560114 commit 0e00d29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/rx-effects/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export * from './action';
export * from './effect';
export * from './scope';

export type { Scope, ExternalScope } from './scope';
export { createScope } from './scope';

export * from './controller';
export * from './handleAction';
export * from './stateDeclaration';
Expand Down
7 changes: 6 additions & 1 deletion packages/rx-effects/src/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createStore, Store, StoreOptions } from './store';
/**
* A controller-like boundary for effects and business logic.
*
* It collects all subscriptions which are made by child entities and provides
* `Scope` collects all subscriptions which are made by child entities and provides
* `destroy()` method to unsubscribe from them.
*/
export type Scope = Controller<{
Expand Down Expand Up @@ -64,6 +64,11 @@ export type Scope = Controller<{
) => Effect<Event, Result, ErrorType>;
}>;

/**
* `ExternalScope` and `Scope` types allow to distinct which third-party code can invoke `destroy()` method.
*/
export type ExternalScope = Omit<Scope, 'destroy'>;

/**
* Creates `Scope` instance.
*/
Expand Down

0 comments on commit 0e00d29

Please sign in to comment.