krakenjs / post-robot

Cross domain post-messaging on the client side using a simple listener/client pattern.
Apache License 2.0
746 stars 91 forks source link

Is there a way to test whether a handler is already set? #41

Open ricklang opened 6 years ago

ricklang commented 6 years ago

For example, how I test whether the following handler was already set? Looks like I can catch the exception. Just want to know whether there is a more elegant way.

postRobot.on('getUser', function(event) { .... });

svenyonson commented 6 years ago

That would be useful for me as well, as I am getting an error that a handler has already been set when I try to open a child window multiple times in a session. Is there a way to cancel all listeners without storing each listener in a var at the time it is created? Something like postRobot.cancelAll()?

Cijin commented 4 years ago

Is this issue taken up already? Could I give it a try please?

mnicpt commented 4 years ago

@Cijin This has already been taken up and PR created. Thank you for your interest.

Cijin commented 4 years ago

@mnicpt No worries at all. I got assigned another issue. :smile: