Closed flynx closed 10 months ago
+1, the documentation says import/export functions are async but we can't actually use it in an async context because it's impossible to know when the operations are done. Quite frustrating
The below PR allows for await
on export method, which resolves immediately after the last call to callback
was made.
Hi,
It seems that
.export(..)
, at least on theIndex
, returns true right away but internally runs asynchronously, this is a big issue if one is trying to partition or join the exported data in a custom way, for example it is not possible to collect all the exported data into one object and do something with it...A basic example:
This prints out:
It would be nice/logical to be able to
await
for the export to be done, i.e. for.export(..)
to return a promise.Would also be nice if this promise would account for the handler returning a promise, i.e. resolve when all the returned values are resolved (i.e. via
Promise.all(..)
)Thanks!