-
Notifications
You must be signed in to change notification settings - Fork 33
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
model eventbus #69
base: master
Are you sure you want to change the base?
model eventbus #69
Conversation
6bbcef6
to
453e8eb
Compare
@Ako-Njang thank you, this is a great start. I think you can keep improving this even further: For example, all functions that have a final argument: // original
function someFunction(a, b, callback) {
// some code
if (success)
callback(null, result);
} else {
callback(error);
}
} Can be transformed to: // original
function someFunction(a, b) {
return new Promise(onSuccess, onFailure) => {
// some code
if (success)
onSuccess(result);
} else {
onFailure(error);
}
});
} This means that later users can use this new API as: let reply = await eventBus.send(x, y); As the return of the function is a promise users can write simpler code with async/await (or if they need to support older browsers), then chaining promises is also possible and still more readable than the older callback style. |
Thank you for this. I was a little confused about how the promises would be used. I will keep in mind the promises are for users who will install the library later in their projects. Thanks for clearing my doubts. I will begin this phase. I appreciate the feedback. |
Yes, promises can be used with any browser (except really old ones or IE10) but those don't support webrtc either. Old browsers may not support the // new browser:
let reply = await eventBus.send(a, b);
// older (on the same code)
eventBus.send(a, b)
.then(reply => {
// code that uses the reply...
}); |
This week ( 06 - 10/06/2022 )
- Understand the core functionality and interfaces that webRTC provides
and how to implement.
- Went through code proposed and ran it successfully
- Will try to implement an example myself to make sure I understand the
concepts
- Understand the core functionality Vert.x Event bus provides so that I
can work on preserving them..
- Advance with my blogpost
Next week (13 - 17/06/2022)
- Come out with a design on how to map features of the Event bus to the
corresponding webRTC feature.
- Begin work on implementing the javaScript Event bus with webRTC as the
required library.
- Work on mentor feedback.
- Advance with my blog post
Message ID: <vert-x3/vertx-eventbus-bridge-clients/pull/69/c1106751098@
… github.com>
|
@pmlopes here is simple modeling of the EventBus object I did. I also did some refactoring to suit ES6 with respect to variables and function declarations. While working on creating promises to replace the callbacks can you have any suggestions?