0.0.1 • Published 3 years ago
@p4ck493/rxjs-take-until-decorator v0.0.1
rxjs-take-until-decorator
Prerequisites
You can wrap your object in a decorator and use methods to unsubscribe from listening to data streams, or inherit methods from an abstract class that will help you do the same.
For Angular project, package has a wrapper for ngOnDestroy.
Table of contents
Installation
npm install @p4ck493/rxjs-take-until-decoratorUsage
Import
import {TakeUntil} from "@p4ck493/rxjs-take-until-decorator";Example
@TakeUntil.decorator()
class SomeComponent implements TakeUntil.Interface {
public readonly takeUntil!: <T>() => MonoTypeOperatorFunction<T>;
}
// OR
class SomeNextComponent extends TakeUntil.Class {
public someFunctionForCloseSubscribes(): void {
super.takeUntilUnsubscribe();
}
}
// OR
@TakeUntil.decorator()
class SomeComponent implements TakeUntil.Interface {
public readonly takeUntilUnsubscribe!: () => void;
public someFunctionForCloseSubscribes(): void {
this.takeUntilUnsubscribe();
}
}API
| TakeUntil.Interface |
|---|
| this.takeUntilUnsubscribe |
| this.takeUntil |
| TakeUntil.Class |
|---|
| super.takeUntilUnsubscribe |
| super.takeUntil |
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Add your changes:
git add . - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request 😎
Authors
- Ivan Karbashevskyi - Initial work - Karbashevskyi
See also the list of contributors who participated in this project.
License
MIT License © p4ck493