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

Detach custom event listener #384

Merged
merged 3 commits into from
May 24, 2018
Merged

Detach custom event listener #384

merged 3 commits into from
May 24, 2018

Conversation

P0lip
Copy link
Contributor

@P0lip P0lip commented May 20, 2018

Fixes #370

This PR introduces usage of WeakMap, therefore it may be a breaking change, since WeakMap is unsupported in non-ES6 environments and requires a polyfill.
All projects using babel-polyfill should be unaffected.

return map[event]
}

return void 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not seen this return type before - I'd use 'undefined' if they behave similarly.

@@ -33,7 +33,27 @@ const setUntargetItems = function (currentTarget, targetArray) {
}
}

let customListener
const customListeners = {
registry: new WeakMap(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid we won't be able to accept the PR until we can build the standalone with babel-polyfill. Is there a way to use a standard object instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can define a property on given object. This is how WeakMap is usually polyfilled.

@aronhelser
Copy link
Collaborator

Great, the new approach looks reasonable. Can you please add a comment that this is essentially a polyfill for WeakMap? I'll see if I can try it out.

@P0lip
Copy link
Contributor Author

P0lip commented May 24, 2018

Done.

@aronhelser aronhelser merged commit 871b77c into ReactTooltip:master May 24, 2018
@aronhelser
Copy link
Collaborator

🎉 This PR is included in version 3.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants