question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dv.view() - no information about the javascript files

See original GitHub issue

https://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:open
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
AB1908commented, Sep 14, 2022

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.

0reactions
OnkelTemcommented, Sep 14, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found