You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
```dataviewjsconst root = dv.component.component.containerEl;dv.span("def: has context? " + ("ctx" in root ? root.ctx : "no"));if (!("ctx" in root)) { root.ctx = Math.random(); dv.span("<br>"); dv.span("setting context to: " + root.ctx);}``````dataviewjsconst root = dv.component.component.containerEl;dv.span("use: has context? " + ("ctx" in root ? root.ctx : "no"));```
I'm currently experimenting with view based contexts.
right now, I could detect if I'm either in insert mode or in reading mode too. both have their own contexts.
ToDo's:
ensure cleanup when navigating away / providing a event queue for this task
reducing the barrier to a minimum.. maybe even adding dv.ctx or something, to have a context for the current document view. (opening the same document twice, would result in two separate contexts)
documentation
example for the test vault
Why?
well.. I don't like having all the code in one block if I could have many blocks being able to access data defined by the top block.
this would also not only provide access to simple data, but object instances too.
one could literally instanciate an API wrapper at the top and use it in consecutive dataviewjs blocks.
I already have the proof of concept done. I just need to iterate it a little and make it more user friendly.
I'll work on this after sleep. cya tomorrow :)
The text was updated successfully, but these errors were encountered:
the above image is the result of this code:
I'm currently experimenting with view based contexts.
right now, I could detect if I'm either in insert mode or in reading mode too. both have their own contexts.
ToDo's:
Why?
well.. I don't like having all the code in one block if I could have many blocks being able to access data defined by the top block.
this would also not only provide access to simple data, but object instances too.
one could literally instanciate an API wrapper at the top and use it in consecutive dataviewjs blocks.
I already have the proof of concept done. I just need to iterate it a little and make it more user friendly.
I'll work on this after sleep. cya tomorrow :)
The text was updated successfully, but these errors were encountered: