RLesur / crrri

A Chrome Remote Interface written in R

Home Page:https://rlesur.github.io/crrri/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change the name of the await() function

RLesur opened this issue · comments

I regret the name I gave to the await() function.

In JS, await is a keyword that can only be used inside an async function (an async function is a function that always returns a promise). Using await outside an async function is illegal.
I think that makes sense.

Here, the await() function is a wrapper over later::run_now(). For instance, the httpuv package also wraps later::run_now() with the httpuv::service() function.

I think we should rename the await() function.
The only proposal I have would be hold(promise). We could add a delay argument here: hold(promise, delay = 30).

I don't mind renaming even if await is clear about the purpose even if you don't know JS. I understand it as await for the async task, the promise, to be resolved

I would says that wait or wait_for bear the same meaning. hold is ok I guess.
Does adding a delay means that it cover the timeout wrapper idea (#21) ?

await is clear enough, but I think that for people knowing JS, this would be highly confusing.

We still have a wait() function, that is the reason why I was looking for another name.
A delay argument would be a shorthand for hold(promise %>% timeout2(delay)). The timeout2() idea in #21 is still useful.