Re: [twdev] Re: How to use Node modules in browser?

2019-09-03 Thread okido
Hi Bimlas, I use TWc in a straight forward nw.js install. You can include every npm packet as simple as using something like: let UglifyJS = require("uglify-es") in your scripts or inline scripts. Saving requires a plugin that can be found here: https://github.com/nwOkido/nwTWcSaver. Access to

Re: [twdev] Re: How to use Node modules in browser?

2019-08-29 Thread bimlas
> Yes, it should be documented there. > Opened https://github.com/Jermolene/TiddlyWiki5/pull/4213 -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [twdev] Re: How to use Node modules in browser?

2019-08-29 Thread bimlas
Opened https://github.com/Jermolene/TiddlyWiki5/pull/4211 and https://github.com/Jermolene/TiddlyWiki5/pull/4212 -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: [twdev] Re: How to use Node modules in browser?

2019-08-29 Thread bimlas
Jeremy I found why my files didn't load: the code above (https://groups.google.com/d/msg/tiddlywikidev/wKqzwaMfBJw/YwJVbBjGBAAJ) works, but only if I am not using a system tiddler, as they are not loaded by Syncadapter. The description of Syncadaptor is ambiguous

Re: [twdev] Re: How to use Node modules in browser?

2019-08-28 Thread Jeremy Ruston
Hi Bimlas >> To make the browser to pick up changes from the server then you can trigger >> polling with the tm-server-refresh message. In my own experiments I often >> just change the default polling interval from 60s down to 3-5s (via >> $:/config/SyncPollingInterval). > > I'm afraid

Re: [twdev] Re: How to use Node modules in browser?

2019-08-28 Thread bimlas
I also tried Node 12.9.1 installed through NVM, which is the result. Need to create a skinny tiddler and it will be synced? As far as I know it doesn't work with text files: $ mkdir files $ echo "Some text" > ./files/foo.txt $ tiddlywiki --listen - Check that

Re: [twdev] Re: How to use Node modules in browser?

2019-08-28 Thread bimlas
Jeremy, To make the browser to pick up changes from the server then you can trigger > polling with the tm-server-refresh message. In my own experiments I often > just change the default polling interval from 60s down to 3-5s > (via $:/config/SyncPollingInterval). > I'm afraid something is

Re: [twdev] Re: How to use Node modules in browser?

2019-08-27 Thread Jeremy Ruston
Hi Bimlas To make the browser to pick up changes from the server then you can trigger polling with the tm-server-refresh message. In my own experiments I often just change the default polling interval from 60s down to 3-5s (via $:/config/SyncPollingInterval). You may also be interested in

Re: [twdev] Re: How to use Node modules in browser?

2019-08-27 Thread bimlas
I think I found the solution: I have to use this (after the tiddler is modified) in the browser (by an ActionWidget for example): $tw.utils.nextTick(function() { $tw.syncer.enqueueSyncTask({type: "load", title: "$:/communicate-with-server"}) }); -- You received this message because

Re: [twdev] Re: How to use Node modules in browser?

2019-08-27 Thread bimlas
Jeremy, ... have the browser create a tiddler with some flags that gets synced to > the server. The serverside code picks up the tiddler (by searching for the > same flags), and then performs some operation, putting the results back in > the same tiddler. > So far it works so that the server

Re: [twdev] Re: How to use Node modules in browser?

2019-07-11 Thread Brian Theado
Bimlas, If the npm modules you want are compatible with the browser, then you can bundle them into a tiddler and load them directly in the browser. It can be tricky to get it working. I've had the most success using browserify --standalone to get it bundled in a way that it will work with TW's

Re: [twdev] Re: How to use Node modules in browser?

2019-07-11 Thread bimlas
The sync mechanism seems to be usable, I go around the topic, thank you for the idea! PS.: According to your comment , if you would like GitLab saver to 5.1.20, please merge the request

Re: [twdev] Re: How to use Node modules in browser?

2019-07-11 Thread Jeremy Ruston
Hi bimlas > Maybe it's basically a bad way of thinking, so I am reformatting the > question: how can I use NPM modules in a widget? Ah, OK, you’re asking if it is possible from the browser to invoke a function that is running on the server. That would be some kind of RPC mechanism, and we

Re: [twdev] Re: How to use Node modules in browser?

2019-07-11 Thread bimlas
Maybe it's basically a bad way of thinking, so I am reformatting the question: how can I use NPM modules in a widget? -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an

Re: [twdev] Re: How to use Node modules in browser?

2019-07-11 Thread bimlas
Jeremy, Thank you for your reply, but I still don't understand that although it can recognize Node in the code, $:/info/node is always "no" in the browser, so it does not load utils-node modules. How do I use them, for example, in widgets? For example, if I want to use the

Re: [twdev] Re: How to use Node modules in browser?

2019-07-11 Thread Jeremy Ruston
Hi bimlas Apologies, I should have pointed out that $tw.node having the value {} does evaluate to true, as expected. Best wishes Jeremy > On 11 Jul 2019, at 10:54, Jeremy Ruston wrote: > > Hi bimlas > > $tw.boot.boot() is an async function, and takes a callback. TW won’t be fully >

Re: [twdev] Re: How to use Node modules in browser?

2019-07-11 Thread Jeremy Ruston
Hi bimlas $tw.boot.boot() is an async function, and takes a callback. TW won’t be fully initialised until it gets to the callback. So try something like: var $tw = require("./boot/boot.js").TiddlyWiki(); $tw.boot.argv = ['myproject', '--listen']; $tw.boot.boot(function() {

[twdev] Re: How to use Node modules in browser?

2019-07-11 Thread bimlas
To be clear: I need Node because I want to use NPM modules. 2019. július 11., csütörtök 11:34:31 UTC+2 időpontban bimlas a következőt írta: > > Dear all, > > In a Node.js Javascript project, I want to use TiddlyWiki to display data. > > To run Node methods, I need to create modules with