0.0.1 • Published 2 years ago

@p4ck493/rxjs-take-until-decorator v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

NPM Latest Version Downloads Count Bundle Size Test Status Last Update Date Project License Issues Forks Stars Twitter

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-decorator

Usage

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

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Add your changes: git add .
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request 😎

Authors

See also the list of contributors who participated in this project.

License

MIT License © p4ck493