-
Notifications
You must be signed in to change notification settings - Fork 154
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
timeAgo without the timers #178
Comments
Hi, you have a good point there. I currently see three options:
What are your thoughts? |
My preference order would be 3 (best), 1, 2 (worst). Having options objects seems the most future-proofed, but introducing a new pipe is explicit. I'd be reluctant to spoil your API by adding more boolean parameters - values without names are easy to misunderstand I wonder if it might also be possible to specify the default options at module configuration or injection time. Perhaps the library could provide configuration options as a dependency-injected value ( |
I actually like this idea. Can you please come up with a Pull Request for that? |
Description of the Issue and Steps to Reproduce:
Did you search for duplicate issue? [Yes /
No]Please describe the issue and steps to reproduce, preferably with a code sample / plunker:
This is a feature-request, not a bug report. I don't know if it is a good idea, but hoped to start a discussion. As a result, I'm removing the environmental details from the PR template (it's about the structure of code, and will be consistent across environments).
I was using
amTimeAgo
in my code, and for other reasons I was trying to control time usingfakeAsync
andtick
. That worked perfectly well everywhere except whereamTimeAgo
was used, and I traced this back to the structure of thetimeAgo
pipe, which indefinitely schedules a job to update the value output by the pipe (so that it live-refreshes as time passes).While this is quite clever and a great default behaviour, most of the dates in my app are on the timescale of months and years, and performance is an issue - I'd quite like to be able to disable the timed-updates. I should add that my motives are not just performance: the structure made testing difficult, as
fakeAsync
throws exceptions when there are tasks left on the queue, and since the pipe reschedules tasks indefinitely, there were always tasks left on the queue. I couldn't find a good way to usefakeAsync
around a component containingamTimeAgo
.Might this be something you'd consider adding as a configuration option on the pipe? Does it exist already, and I've just overlooked it?
Many thanks!
The text was updated successfully, but these errors were encountered: