Closed LumosLovegood closed 2 years ago
This is supported on develop but not the latest release; 0.5.0 should fix this for your use case.
Thanks! And I found a solution for this use case.
Putting the view creator function in an async function can solve this problem.
In my javascript:
weatherView();
async function weatherView(){
let weather = await getWeather(city,days);
dv.table(["date","weather","temp","cloud","moonPhase"],weather.map(t => [t.fxDate.substring(5),t.textDay,t.tempMin+"~"+t.tempMax+"℃",t.cloud+"%",t.moonPhase]));
}
In dataviewjs:
dv.view("Utils/Scripts/weatherView",setting)
What happened?
Evaluation Error: SyntaxError: await is only valid in async function at new Function () at DataviewInlineApi.view (eval at (app://obsidian.md/app.js:1:1433712), :15617:24) at async DataviewJSRenderer.render (eval at (app://obsidian.md/app.js:1:1433712), :16267:13)
DQL
JS
Dataview Version
0.4.26
Obsidian Version
0.13.33
OS
Windows