Rocket.Chat.Apps-engine
Rocket.Chat.Apps-engine copied to clipboard
Unable to use setTimeout() in Rocket.Chat App
In our dip-application we're using setTimeout()
and catching errors like this (pay attention to the top line):
As we understand, timers support was added earlier in the apps-engine (around 2021). But now, as we can see, it is not possible to get setTimeout
. Is there any way to solve this problem?
@d-gubert @murtaza98 hey! Can you check that please?
We asked earlier with this PR to enable timers.
setTimeout
is intentionally disabled because once you do that then you lose scope and context inside of the App and the logs. The recommended route is to use promises as the Apps Engine tracks the context based on the initial promise. @d-gubert can correct me if I am wrong, but I doubt support will be added.
setTimeout
is intentionally disabled because once you do that then you lose scope and context inside of the App and the logs. The recommended route is to use promises as the Apps Engine tracks the context based on the initial promise. @d-gubert can correct me if I am wrong, but I doubt support will be added.
@graywolf336 we need timers for our delay method:
In our case, it's necessary to resolve promise with a certain delay, so setTimeout()
, as we see, is the best way to realize our goals.