Skip to content

Commit

Permalink
refactor: simplify promise resolvement
Browse files Browse the repository at this point in the history
  • Loading branch information
vobu committed Feb 16, 2022
1 parent 349b511 commit 9fabcac
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/lib/wdi5-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class WDI5Control {
/**
* @return {WebdriverIO.Element} the webdriver Element
*/
getWebElement() {
async getWebElement() {
//// TODO: check this "fix"
//// why is the renew necessary here?
//// it causes hiccup with the fluent async api as the transition from node-scope
Expand All @@ -91,9 +91,7 @@ export class WDI5Control {
// await this.renewWebElementReference()
// }
if (util.types.isProxy(this.getWebElement)) {
return (this._webdriverRepresentation as Promise<any>).then(
(webdriverRepresentation) => webdriverRepresentation
)
return await Promise.resolve(this._webdriverRepresentation) // to plug into fluent async api
} else {
return this._webdriverRepresentation
}
Expand Down

0 comments on commit 9fabcac

Please # to comment.