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

Optimizations and bug fix #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Optimizations and bug fix #3

wants to merge 1 commit into from

Conversation

DickyT
Copy link
Contributor

@DickyT DickyT commented Jan 24, 2016

Hi there,
I noticed that inside the addListener, if someone trying to listen to an event which is already listened before, which will cause RNTGlobalEventEmitter.addObserver(eventName); run one more time, which is unnecessary to register an native listener at NSNotificationCenter.

Whats more, I added removeListenderById method, because sometimes to deal with scope issues, you need to passing a closure / code block to the addListener, which makes removeListener harder. With removeListenderById, you only need to passing the event name and the reference ID, which can get from addListener.

@@ -59,6 +58,7 @@ var DeviceMotion = {
emit,
removeListener,
removeAllListeners,
removeListenderById
Copy link
Owner

Choose a reason for hiding this comment

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

spelling

@paramaggarwal
Copy link
Owner

Looks good @DickyT. Just two tiny comments, and we can merge it in.

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