A
A
Anton Shvets2017-12-28 00:26:28
htaccess
Anton Shvets, 2017-12-28 00:26:28

How to execute Promise.all from object array methods?

There is an array of objects of type

{
...
 action: async function() {...}
}

Let's call it objs
How can I do something like Promise.all (objs.action)so that they all start executing at the same time
The only thing that comes to mind is
let does = objs.map( e => e.action.bind(e));
let results = await Promise.all(does)

But it doesn't work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2019-10-21
@HiLevel

RewriteEngine On
RewriteCond %{REQUEST_URI} /tg/(.+)$ [OR,NC]
RewriteCond %{REQUEST_FILENAME} !/tg\.php$
RewriteRule ^(.*)$ /tg.php [L]

RewriteCond %{REQUEST_URI} /vk/(.+)$ [OR,NC]
RewriteCond %{REQUEST_FILENAME} !/vk\.php$
RewriteRule ^(.*)$ /vk.php [L]

L
lemme, 2017-12-28
@Xuxicheta

e.action.call(e)
bind does not call the function...
https://jsfiddle.net/48p3548r/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question