Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(signals): rename rxMethod.unsubscribe to destroy #4584

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

markostanimirovic
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the new behavior?

The unsubscribe method from rxMethod is renamed to destroy.

Does this PR introduce a breaking change?

[x] Yes
[ ] No
BREAKING CHANGES:

The `unsubscribe` method from `rxMethod` is renamed to `destroy`.

BEFORE:

const logNumber = rxMethod<number>(tap(console.log));

const num1Ref = logNumber(interval(1_000));
const num2Ref = logNumber(interval(2_000));

// destroy `num1Ref` after 2 seconds
setTimeout(() => num1Ref.unsubscribe(), 2_000);

// destroy all reactive method refs after 5 seconds
setTimeout(() => logNumber.unsubscribe(), 5_000);

AFTER:

const logNumber = rxMethod<number>(tap(console.log));

const num1Ref = logNumber(interval(1_000));
const num2Ref = logNumber(interval(2_000));

// destroy `num1Ref` after 2 seconds
setTimeout(() => num1Ref.destroy(), 2_000);

// destroy all reactive method refs after 5 seconds
setTimeout(() => logNumber.destroy(), 5_000);

Copy link

netlify bot commented Nov 12, 2024

Deploy Preview for ngrx-io ready!

Name Link
🔨 Latest commit bf7e22f
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/67351376df77340009180704
😎 Deploy Preview https://deploy-preview-4584--ngrx-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

BREAKING CHANGES:

The `unsubscribe` method from `rxMethod` is renamed to `destroy`.

BEFORE:

const logNumber = rxMethod<number>(tap(console.log));

const num1$ = interval(1_000);
const num2$ = interval(2_000);

const num1Ref = logNumber(num1$);
const num2Ref = logNumber(num2$);

// destroy `num1Ref` after 2 seconds
setTimeout(() => num1Ref.unsubscribe(), 2_000);

// destroy all reactive method refs after 5 seconds
setTimeout(() => logNumber.unsubscribe(), 5_000);

AFTER:

const logNumber = rxMethod<number>(tap(console.log));

const num1$ = interval(1_000);
const num2$ = interval(2_000);

const num1Ref = logNumber(num1$);
const num2Ref = logNumber(num2$);

// destroy `num1Ref` after 2 seconds
setTimeout(() => num1Ref.destroy(), 2_000);

// destroy all reactive method refs after 5 seconds
setTimeout(() => logNumber.destroy(), 5_000);
@markostanimirovic markostanimirovic force-pushed the feat/signals/rx-method-destroy branch from 7bc135c to bf7e22f Compare November 13, 2024 21:00
@markostanimirovic markostanimirovic merged commit 57ad5c5 into main Nov 13, 2024
11 checks passed
@markostanimirovic markostanimirovic deleted the feat/signals/rx-method-destroy branch November 13, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants