Getting error removeEventListner called without a function or namespace. This will remove all listeners for this event type. This is not allowed. Please specify a function or namespace to remove

WebViewer Version:

Do you have an issue with a specific file(s)?
Can you reproduce using one of our samples or online demos?
Are you using the WebViewer server?
Does the issue only happen on certain browsers?
Is your issue related to a front-end framework?
Yes issue is for front end
Is your issue related to annotations?

Please give a brief summary of your issue:
Getting error removeEventListner called without a function or namespace.

Please describe your issue and provide steps to reproduce it:

I am using the webviewer of version 8.1.0 and in this version I use this code.
I am deleting the annotations using.
annotationManager.deleteAnnotations(annotation Manager.getAnnotationList());

and then I am trying to remove event listener for Annotations loaded by below line in code.


Now I have upgraded the webviewer version to latest 10.7.1 and I was getting
Getting error removeEventListner called without a function or namespace or it is saying to specify function.

As per error i understood that we have to call the removeEventListner method with Namespace

Can you please help me to fix the issue. How to fix this if want send namespace along with it what is the namespace for annotationsLoaded how can we get to know it from apryse documentation I am not able to find an example for this in documentation to fix.
Can you please provide fix with clear info how it works?

Please provide a link to a minimal sample where the issue is reproducible:


Hi there,

Thank you for reaching out to WebViewer forums,

If you want the event to only trigger once, you can unsubscribe from the event like so:

For using the removeEventListener, one of the breaking change was to specify the function, here is change-log example:

Best regards,
Kevin Kim

Hello Kevin kim,

Thanks for the response but do we have option to remove event listner globally in latest version

Hi there,

While it is possible to remove all event listeners globally from the object, i.e. documentViewer.removeEventListener()

we recommend you to specify the specific events you want to remove.

Best regards,
Kevin Kim

Ok but to remove specific event we need to mention function or namespace space right is there a way like with mentioning the function remove the event like it used to happen before

Hi there,

You can always add a callback function to the original event that you are adding. And then reference that when you are removing the event.

For example, adding an event:

  const click = async (e) => {
  documentViewer.addEventListener('click', click);

Removing the event:

documentViewer.removeEventListener('click', click)

Best regards,
Kevin Kim

Hi! Just want to follow up on this question - I have the exact same issue. I guess the question we have here is how can we remove a event listener defined in Apryse UI (which I donā€™t have the access to the function).
For my case, it is ā€˜contentEditDocumentDigitallySignedā€™ event. Iā€™m wondering if I could know the namespace of this event? Thanks you!

Hi there,

For default WebViewer events, we do not have the namespace exposed to remove them.

Best regards,
Kevin Kim

1 Like