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

refactor(component): use RenderScheduler as a service #3493

Conversation

markostanimirovic
Copy link
Member

@markostanimirovic markostanimirovic commented Jul 16, 2022

This PR converts RenderScheduler to a service, so it could be also used in the following way:

import { RenderScheduler } from '@ngrx/component';

@Component({
  providers: [RenderScheduler],
})
export class TestComponent {
  constructor(private readonly renderScheduler: RenderScheduler) {}

  doSomething(): void {
    // ...
    this.renderScheduler.schedule();
  }
}

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

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

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

This PR currently depends on #3488

@netlify
Copy link

netlify bot commented Jul 16, 2022

Deploy Preview for ngrx-io canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 7be2b7e
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/62ecfc141a371800088f1206

@markostanimirovic markostanimirovic force-pushed the refactor/component/render-scheduler branch 2 times, most recently from 5aa2354 to a5cfe3f Compare July 18, 2022 23:33
@markostanimirovic markostanimirovic force-pushed the refactor/component/render-scheduler branch from a5cfe3f to ddacaa0 Compare July 25, 2022 22:29
@markostanimirovic markostanimirovic force-pushed the refactor/component/render-scheduler branch from ddacaa0 to 6502da9 Compare August 2, 2022 21:50
@markostanimirovic markostanimirovic marked this pull request as ready for review August 2, 2022 21:52
Copy link
Member

@brandonroberts brandonroberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


return { schedule };
export function createRenderScheduler(): RenderScheduler {
return new RenderScheduler(inject(ChangeDetectorRef), inject(TickScheduler));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@timdeschryver timdeschryver merged commit d97e75a into ngrx:master Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants