New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ukon1990/subscription-manager

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ukon1990/subscription-manager - npm Package Compare versions

Comparing version 1.1.0-beta.4 to 1.1.1

4

package.json
{
"name": "@ukon1990/subscription-manager",
"version": "1.1.0-beta.4",
"version": "1.1.1",
"description": "This does hopefully make subscription management less tedious, and helps clean up your code with less variables.",

@@ -10,3 +10,3 @@ "main": "dist/index.js",

"test": "jest",
"publish": "tsc & npm publish --access public"
"publish": "tsc && npm publish --access public"
},

@@ -13,0 +13,0 @@ "keywords": [

@@ -1,8 +0,9 @@

# RXjs Subscription manager
This does hopefully make subscription management less tedious, and helps clean up your code with less variables.
# RXJS Subscription manager
This does hopefully make subscription management less tedious, and helps clean up your code with fewer variables and
fewer lines of repeated code.
You can install it like this:``npm i --save @ukon1990/subscription-manager``
Originally this code base were written before I found out about the
basic ``subscription.add()``, but then you need to write more code manually. But i still find this method preferable,
Originally this code base was written before I found out about the
basic ``subscription.add()``, but then you need to write more code manually. I still find this method preferable,
for my use-cases.

@@ -31,11 +32,9 @@

});
// Unsubscribe upon the first event.
// but also makes sure that it is being unsubscribed as usual if no event is triggered
this.subs.addSingleEvent(
this.form.controls.firstName.valueChanges,
(change) => this.onNameChange(change));
this.subs.add(
this.form.controls.firstName.valueChanges,
(change) => this.onNameChange(change), {
// Unsubscribe upon the first event.
// but also makes sure that it is being unsubscribed as usual if no event is triggered
terminateUponEvent: true
});
this.subs.add(
this.form.controls.surname.valueChanges,

@@ -106,9 +105,9 @@ (change) => this.onNameChange(change), {

There is also not less repeatable code hopefully.
The SubscriptionManager should hopefully reduce unnecessary repeated code, for these kinds of things.
You don't need to do valueChanges.subscribe, and you don't need to add a pipe and takeWhile/Until and all that, if you
just want the subscription to terminate upon the first event.
just want the subscription to terminate upon the first event. You can just use the addSingleEvent function instead of the add function.
You can also get subscription manager to return the list or map of the subscriptions with ``.getMap()`` or ``.getList()``.
You can also get subscription manager to return the list or map of the subscriptions with ``.getMap()``(only those whom have an ID) or ``.getList()``.
If you want, you can also do add the ``.pipe(takeWhile(...logic...))`` if you want.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc