alexkendall / react-native-bluetooth-cross-platform

Cross-Platform Bluetooth & WiFi React Native Module. Powered by underdark http://underdark.io/.
179 stars 35 forks source link

removeListeners() function #34

Closed azanli closed 6 years ago

azanli commented 6 years ago

Includes a single function to remove all listeners attached to NativeEmitter. Also updates the sdk to reflect this change in the example subscribe/unsubscribe workflow.

The reason I did this was because I had trouble following the docs to get the unsubscribe part to work. This method works and is a bit less wordy.

azanli commented 6 years ago

Nevermind again. I just noticed what I was doing wrong the whole time. The documented way works perfectly fine and listener.remove() should not be called if it wasn't subscribed in the first place. Sorry for the noise.