Hi Matt,

when running under node, tiddlywiki creates two instances of itself - open 
runs under nodejs and the other is run in the browser, the two instances 
sync with each other (send tiddlers to each other). 

In *create-pinboard-tiddlers.js*  you will see the line

if (!$tw.node) return;


this means the code only runs on the nodejs tiddlywiki instance, it has no 
effect in the browser instance, therefore your code must run in the nodejs 
instance, so things are more complicated. One possiblity may be to use the 
tiddlywiki 'hooks' and run some code when a particular tiddler is saved.


All the best 

BJ


On Wednesday, March 22, 2017 at 3:45:26 AM UTC+1, Matt Groth wrote:
>
> Hey all,
>
> I need to run a startup module without having to restart the server. 
> Specifically, I am talking about the pinboard bookmarks plugin created by 
> moderatemisbehaviour. 
> <https://github.com/moderatemisbehaviour/TW5-get-pinboard-bookmarks> He 
> mentions in the readme's roadmap that he might add this, but I need it 
> sooner so I'm trying to make it myself. I want to reload my pinboard 
> bookmarks by simply clicking a button.
>
> The closest I have been able to get is this snippet:
>
> $tw.boot.remainingStartupModules = []; // Array of startup modules
>  $tw.modules.forEachModuleOfType("startup",function(title,module) {
>  if(module.startup) {
>  $tw.boot.remainingStartupModules.push(module);
>  }
>  });
>
>
>     function isPIN(element) {
>       return element.name = 
> "$:/get-pinboard-bookmarks/create-pinboard-tiddlers.js";
>     }
>     
>     task = $tw.boot.remainingStartupModules.find(isPIN);
>     
>     task.startup();
>
> I think this gets the correct task, but I don't think startup function is 
> executing. I'm pretty inexperienced in all of this, but I have a feeling 
> this is some sort of scope issue. I don't fully understand what javascript 
> all of the different agents in play have access to. I could be wrong 
> though, and this might have nothing to do with scope. I have tried running 
> this in both the dev tools and as a Chrome Extension, but neither works.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1445ca25-890d-4b2d-971a-d2af38eff5ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to