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

Calendar pipe: wrap setTimeout with outsideAngularApp #135

Merged
merged 5 commits into from
Mar 18, 2017

Conversation

romanovma
Copy link
Contributor

 - make initTimer to be not static anymore
 - pass NgZone and ChangeDetectorRef as parameters to InitTimer method
Copy link
Owner

@urish urish left a comment

Choose a reason for hiding this comment

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

Thanks! I reviewed the changes, here are some comments

CalendarPipe.removeTimer();
CalendarPipe.initTimer(ngZone, cdRef);
ngZone.run(() => cdRef.markForCheck());
}, timeToUpdate);
Copy link
Owner

Choose a reason for hiding this comment

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

We don't really need to run the markForCheck() here - we emit an event on the midnight emitter, and the constructor subscribes and runs the change detector. Since there can be several change detector refs, it makes sense to keep this call inside the constructor.

Also, I think we can remove the runOutsideAngular() from the constructor itself - it seems to be unnecessary left over from times when the timer was created directly inside the constructor.

 - remove change detection from InitTimer method
@romanovma
Copy link
Contributor Author

Done :)

@romanovma
Copy link
Contributor Author

Sorry, one more fix. Return a timer from runOutsideAngular method to assign it to the CalendarPipe.timer

@urish urish merged commit 7bfaffb into urish:master Mar 18, 2017
@urish
Copy link
Owner

urish commented Mar 18, 2017

thanks, looks good!

@urish
Copy link
Owner

urish commented Mar 18, 2017

released as 1.3.3

@romanovma romanovma deleted the issue-132 branch March 20, 2017 03:09
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.

2 participants