humanswitch/consentcookie

use of ConsentCookie.off function results in error

rockxwre opened this issue · 0 comments

Description

When unregistering a listener with ConsentCookie.off the error:

app.js?7ac9:104 Uncaught TypeError: mainInstance.off is not a function
at Object.off (eval at (consentcookie.js:1012), :104:23)
at :1:15

is thrown. The listener is still active.

Expected Behavior

No error, listener unregistered (inactive).

Steps to Reproduce

  1. add the following listener at the end of the init script:
window.myListener = function($payload) { console.log($payload); };
ConsentCookie.on("connection", window.myListener); 
  1. execute ConsentCookie.off("connection" , window.myListener) in your browser console