dv.view() - no information about the javascript files
See original GitHub issuehttps://blacksmithgu.github.io/obsidian-dataview/api/code-reference/#dvviewpath-input
Describe the problem Missed information about the javascript files: what format they should use, how to export things?
I tried a few things but none of them worked.
E.g. scripts/view.1js:
console.log(`Loading view1 by ${__filename}`);
function foo(...args) {
console.log('foo is called with args', ...args)
}
module.exports = foo;
And then:
```dataviewjs await dv.view("scripts/view1", 'asd') ```
makes only the loading line in the console:
Loading view1 by /opt/Obsidian/resources/electron.asar/renderer/init.js
so the function foo
was never called. Why?
Describe the solution you’d like I cannot suggest an edit because I didn’t find a solution.
Issue Analytics
- State:
- Created a year ago
- Comments:8
Top Results From Across the Web
Codeblock Reference - Dataview - GitHub Pages
Get page information (via dv.page() ) for the page the script is currently ... Will attempt to load a JavaScript file at the...
Read more >Custom JS Views from Template Files #292 - GitHub
loadView() , which loads a JS function from a file, executes it and displays the ... data input output. Is this valuable? Is...
Read more >How to get started with Obsidian Dataview and DataviewJS
It is similar to Dataview but using JavaScript to access the API that ... dv.taskList(dv.pages().file.tasks.where(t => t.completed));
Read more >DataView - JavaScript - MDN Web Docs
Chrome Edge
DataView Full support. Chrome9. Toggle history Full support. Edge1...
DataView() constructor Full support. Chrome9. Toggle history Full support. Edge1...
DataView() without new throws Full...
Read more >DataviewJS Snippet Showcase - Obsidian Forum
Hi, does anyone know how to use taskList , but have it not include ... taskList(dv.pages().file.tasks .where(t => !t.completed).where(t ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Views aren’t meant to help with that kinda organization if I’m being honest. I doubt this will properly be supported either as it just isn’t as widely used. I do understand where you’re coming from though. Perhaps look at CustomJS plugin.
The dot problem is likely an Obsidian quirk. It doesn’t properly index any folders with leading dots but I’m not quite certain why plugin code is having trouble with it. Perhaps it’s related.
@AB1908 Use case for what, sorry? If you speak about regular exports, then they’re more anticipated by fellow javascript programmers 😃 Natural javascript code organization is also a good thing.