Skip to content

add complete event#54

Open
caseyjhol wants to merge 1 commit into
jasonday:masterfrom
caseyjhol:master
Open

add complete event#54
caseyjhol wants to merge 1 commit into
jasonday:masterfrom
caseyjhol:master

Conversation

@caseyjhol

Copy link
Copy Markdown
Contributor

This triggers the complete.printThis event after a successful print or if the dialog is simply closed. In my use case, I have to change some markup to format it properly before printing, but I needed a signal that it was okay to change it back. I'm using this with AngularJS and was running into a few issues too. A timeout seemed hacky and unreliable, so this was a perfect solution.

See a demo here: http://plnkr.co/edit/qTHfT4e4kwlmEgvnOZWJ?p=preview

Example usage:

$("#print").printThis();

$("#print").on("complete.printThis", function() {
    alert("Print complete")
});

@jasonday

Copy link
Copy Markdown
Owner

Won't merge with 1.x.

The browser stops all processing/rendering when the print dialog is open and restarts when the print dialog is closed. With this pull request, the complete.printThis is not actually executing because it is tied to an event, it is merely in the "queue" when the browser is again active. Because it is arbitrary without specificity, I have not merged this code. However, I have left the pull request open for informative purposes, because for many users this complete event (arbitrary or not) may be useful.

@oculus42

oculus42 commented Jul 16, 2018

Copy link
Copy Markdown
Collaborator

While it's not an event, 1.14.0 has added support for functions including an afterPrint function.

@Gennady-G

Gennady-G commented Oct 25, 2019

Copy link
Copy Markdown

Thank You @oculus42 for this info!

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.

4 participants