TianJagodic / OpenLabDevTools

The web version of the openLab OpenApp Tools for developers
MIT License
0 stars 1 forks source link

Arrow functions and async redundancy #2

Open ghost opened 5 years ago

ghost commented 5 years ago

Inside Login.js, line 18, there is a redundant async.

With asynchronous programming in JavaScript, promises handle asynchronous code with .then() and .catch(), while async/await is an alternative to promises. Also, with async functions. you expect an await somewhere inside...

async is, therefore, a function that returns a promise, and await synchronously executes an operation in a promise and wait for it to resolve

So, firebase.auth().signInWithPopup(provider).then(async function(result) { can be simplified to firebase.auth().signInWithPopup(provider).then(result => {.

Arrow functions in JavaScript remove the need for an explicit function definition.

TianJagodic commented 4 years ago

Ok tnx. Do note that there are 3 branches currently. And that in the master stuff is broken...alot.