-
Notifications
You must be signed in to change notification settings - Fork 773
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(core): support beforeprint and afterprint hooks #1080
feat(core): support beforeprint and afterprint hooks #1080
Conversation
569d6a2
to
6a370ae
Compare
I fixed the lint issues and added a check for |
6a370ae
to
443df46
Compare
@CaerusKaru @ThomasBurleson This is updated for the latest 8.0.0-beta27 now. If anyone needs to test easily I've deployed a separate installable build branch. Update your package.json to use
Please let me know if there are any changes I can make to help get this merged. It is very important for my projects and I know 9.x will be here soon so it'd be nice to have it in before then. |
443df46
to
64101d6
Compare
@CaerusKaru I switched over to the document |
@epelc Looks like some issues with your cast of Also would it be possible to add a unit test for this new feature? |
64101d6
to
d8ab973
Compare
Extends the PrintHook service to also register beforeprint and afterprint event handlers to synchronously update styles and prevent layout switching races. Related angular#603
d8ab973
to
a55a801
Compare
@CaerusKaru the document should be fixed build/test work. I switched it to I'm not really sure how to write tests for this. I tried looking for the print-hook tests and there is only one small one in the |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Extends the PrintHook service to also register beforeprint and afterprint event handlers to synchronously update styles and prevent layout switching races.
The PrintHook service was good at handling show/hide but layout changes between row/column were having many race issues and more often than not they were not working while printing due to the underlying
matchMedia
api being async.Related #603
See #603 (comment) for proposal and more info.
CC @CaerusKaru @ThomasBurleson
The main issue I had figuring this out was actually the deactivation of printing and getting the PrintHook service to restore the original media queries. I ended up figuring out a bit how the deactivations are stored and that essentially the following events happen.
isPrintingBeforeAfterEvent
boolean sincebeforeprint
fires before these mql changesThis kind of explains the flow a little better. Just leaving this and the above to document how this all works since it was kind of a pain to figure out.