-
Notifications
You must be signed in to change notification settings - Fork 99
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
Some bugfixes #69
base: master
Are you sure you want to change the base?
Some bugfixes #69
Conversation
…ady initialized Fixed bug in zeroConf scan method; as say in docs, it was emitting update method instead start(). Added second verification in Java onServiceResolved method, to ensure that hostAddress has been provided in the object Now, in every "update" emit, updated service name is provided. New method getResolvedServices added, to get only fully resolved services. Stop method converted to async method; now waits until process finishes. Docs fixed and updated.
…unction that was only accepting Objects. Added support in the same method for both types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for these! 🙂
@Nullable String errorString | ||
) { | ||
if (errorString == null){ | ||
reactContext | ||
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) | ||
.emit(eventName, params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use a simple ternary here to avoid repeating the same code, and send the errorString instead of the params if it's defined.
From my understanding, the errorString couldn't work because it was a String instead of an Object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry this block is wrong. I´m going to upload a fix for this ;)
package.json
Outdated
@@ -2,7 +2,7 @@ | |||
"name": "react-native-zeroconf", | |||
"version": "0.9.0", | |||
"description": "A Zeroconf discovery utility for react-native", | |||
"main": "dist", | |||
"main": "src", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt this is right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don´t use minifying ;)
@@ -20,7 +21,7 @@ export default class Zeroconf extends EventEmitter { | |||
addDeviceListeners () { | |||
|
|||
if (Object.keys(this._dListeners).length) { | |||
return this.emit('error', new Error('RNZeroconf listeners already in place.')) | |||
return this.emit('error', 'RNZeroconf listeners already in place.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why emit a simple string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only want to know if an error has ocurred (string is enough). If you pass an Error, you will get a red screen in debug mode, and an app crash in release mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair
…nd this is not possible.
…resolvedServices.
…uces an app crash in release (bundled) mode. Now, the error event has a different key that can be correctly handled with a listener. It fixes "Uncaught, unhandled 'error' event (-72000)" issue.
Thanks |
Hi there Balthazar!
First of all, thank you so much for the module, has been very useful for my project!
I´ve made some changes and bugfixes to the module, be free to make the changes you desire. I´m sending to you to be shared with Github´s community ;)
Thanks!