Skip to content
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

Remove specific event handlers #6

Open
brandonburkett opened this issue May 16, 2019 · 1 comment
Open

Remove specific event handlers #6

brandonburkett opened this issue May 16, 2019 · 1 comment

Comments

@brandonburkett
Copy link

It would be cool if we could optionally pass in the name of the event listener we wanted to clear / remove. EX: Spreedly.removeHandlers('validation')

Thanks

@mikemeyerson
Copy link

I'd also appreciate this functionality - I have different events/flows handled in separate React hooks and it would be nice to have some granularity in removing tokenization handlers without removing consoleError handling, for example.

In case multiple handlers are listening to a single event (i.e. recache validation vs tokenization validation) I would suggest maybe a setup similar to setTimeout/clearTimeout:

useEffect(() => {
  const handlerId = Spreedly.on('validation', () => {});

  return => {
    Spreedly.removeHandler(handlerId);
  };
}, []);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants