Skip to content

Conversation

@andonivianez
Copy link

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!

…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.
Copy link
Owner

@balthazar balthazar left a comment

Choose a reason for hiding this comment

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

Thanks for these! 🙂

if (errorString == null){
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
Copy link
Owner

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?

Copy link
Author

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 ;)

"version": "0.9.0",
"description": "A Zeroconf discovery utility for react-native",
"main": "dist",
"main": "src",
Copy link
Owner

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

Copy link
Author

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 ;)


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.')
Copy link
Owner

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?

Copy link
Author

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

Copy link
Owner

Choose a reason for hiding this comment

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

fair

…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.
@cornbread78
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants