- I’m editing a file - drawing an annotation;
- quickly switch to another file
- annotationChanged event was never fired
How can i handle this case - when annotationChanged havent fired yet due to Apryse’s embedded timeout, but user has already closed that file?
Hello, I’m AiRon, an automated tech support bot ![]()
While you wait for one of our customer support representatives, I can help you with your question.
It seems you are encountering an issue with the
annotationChanged event not firing immediately due to a possible delay or throttling when switching between files quickly in Apryse’s WebViewer SDK. This can occur if there is a delay in handling the annotation events, which might be due to throttling mechanisms within the SDK to optimize performance.Some things you can try:
- Ensure that the event listener for
annotationChangedis set up correctly and is not being removed when switching files. - Consider using a debounce or throttle mechanism to handle rapid changes and ensure that events are processed in a timely manner.
- Check if the issue persists in both development and production environments, as certain behaviors might differ.
- Implement a cleanup function to handle any pending events when a file is closed or switched.
Here are some resources that might help you:
- Annotation Events - Apryse Documentation: Details about the
annotationChangedevent and its parameters. - Setting up listen/trigger events for real-time collaboration in the client: Information on handling events and collaboration.
- Import/export annotations Database: Learn how to manage annotations effectively with import/export functionalities.
- Custom UI Enhancements to WebViewer with React: Examples of customizing WebViewer in React, which might offer insight into handling events.
Hopefully, this helps you solve your problem while you wait for a human to get back to you.
Hello Ihor,
Thank you for contacting Apryse Forums.
Perhaps, you can wait for the specific event to occur. Try wrapping the event listener in a Promise to wait for the annotationChanged event to fire before closing the file.
Best Regards,
Darian