Open vitaly opened 3 years ago
Dataview has explicit support for async/await
(and will wrap your code in an implicit async function if you have an await); what is your code? Doing something like
let value = await ...;
works fine in Dataview.
it works in dataview codeblock, but it doesn't work in a view
.
I had to do this in a view (and it's not exactly correct, ad it still returns a promise and don't make sure all is rendered before returning:
(async () => {
dv.container = await ad("note", ...
...
})();
and then I use it in a codeblock as dv.view('view path')
Ah, I understand. Views can also be asynchronous by returning a Promiseawait
like the main dataview codeblocks do.
Something like
return (async () => {
....
})();
I will add direct support for this, the same way normal codeblocks work.
trying to move code from customJs into a dataview view, I get this:
await is only valid in async function