Add mathjs singleton and expose it via API#481
Add mathjs singleton and expose it via API#481mProjectsCode merged 1 commit intomProjectsCode:masterfrom
mathjs singleton and expose it via API#481Conversation
This brings up an important point. The additions to mathjs only work once the code adding them has run. Code block execution order in a file is usually top to bottom, but that is not guaranteed. They can theoretically run in any order, so math view fields could run before the js-engine code block adding the needed mathjs extensions. One approach could be to enable users to somehow register global mathjs extensions on plugin load. |
that would be super annoying if it happens randomly sometimes.
I also thought about adding a config option where the user could input a object to initialize the context with. This was just the quickest way to get a working version to test if it works at all. |
|
yeah, maybe a path to a JS file that get's run via js-engine at statup |
I like the Idea, maybe identically to how Base Obsidian handles css snippets, just as JS snippets. But it starts to feel more like it should be a Feature of JS-engine now? |
Yeah. Maybe it's better to just add a simple API to MB and the startup script thing to js-engine |
|
After a few days of thought, I want to go with a simple API on the MB side and adding startup scripts to js-engine. |
|
I just released statup scripts in js-engine |
9ad4629 to
20978cd
Compare
This allows for modification of `mathjs` by the user, mostly to allow for the use of `math.import` to define custom functions
20978cd to
24f312c
Compare
a2d6101 to
e84db40
Compare
mProjectsCode
left a comment
There was a problem hiding this comment.
Looks good so far, but I think tutorial should be moved to the docs.
e84db40 to
4d09aab
Compare
|
documentation moved to mProjectsCode/obsidian-meta-bind-plugin-docs#12 |
|
Thanks :) |
This allows for modification of
mathjsby the user, mostly to allow for the use ofmath.importto define custom functions.See the new
Advanced Examples/Customising mathjsfor details.closes #480
This is a first implementation, it works but I am sure there are better ways to implement the singleton.
Finding the right place in the lifecycle of the app just went over my head
I am also unsure if the
MathjsInstanceshould be per-app or per file?