How to work with async in selenium for javascript?

Killed a lot of time on tests. Whether I have a problem with understanding async, whether one of the two.
Please tell me the working pattern in js.

const isVisible = (element) => browser.wait(until.elementIsVisible(element), 20000);

// async function isVisible(element) {
// await browser.wait(until.elementIsVisible(element), 20000);

loadingProcess async function() {
 const loading = await browser.wait(until.elementLocated(By.xpath("//div[@id='loading']")), 20000);
 await browser.wait(until.elementIsNotVisible(loading), 20000);
await browser.get(myURL);

// the tar-param-pam

const loginBtn = await browser.wait(until.elementLocated('login')), 20000).then(isVisible);;
loadingProcess await();

await browser.wait(until.elementLocated(By.linkText('Websites')), 20000).then(isVisible).then(btn =>;
await browser.wait(until.elementLocated(By.xpath("//input[contains(@class, 'textbox')]/../../td[2]/a")), 20000).then(isVisible).then(btn =>;
loadingProcess await();

await browser.wait(until.elementLocated(By.xpath('//a[text()=" Create directory"]')), 20000).then(isVisible).then(btn =>;

All of this somehow works, but not always. I have doubts about the features loadingProcess and isVisible. If isVisible rewrite using async (commented out option), the driver generally does not wait. loadingProcess also fulfills as it is necessary in 4 cases out of 5.
Perhaps there is some more modern and short way? To do crutches with the driver.sleep() definitely don't want.
div[@id='loading'] - div, which covers the entire visible area of the browser and becomes display:none, when the download ends.
April 3rd 20 at 17:39
0 answer

Find more questions by tags JavaScriptSelenium