[tw] Re: [TWC] How to delay the execution of a macro or a part of it

2017-07-14 Thread Yakov
Hello whatever, today I've read a very nice article about browsers' JS main loop and Web Workers [*] and it seems that Web Workers is exactly what you need. Like you said, JS is a single-thread, but Web Workers "break this rule": they are processed in separate threads and hence don't hang the

[tw] Re: [TWC] How to delay the execution of a macro or a part of it

2017-07-11 Thread whatever
Hey! I think the issue is that JS is a single-thread language, if I understand correctly. I'm guessing that when you open the tiddler, the wikifier gets the content, queues all the macros inside it and only shows the tiddler once all macros have executed. I'll try playing around with Promises

[tw] Re: [TWC] How to delay the execution of a macro or a part of it

2017-07-11 Thread Yakov
Well, it sounds like Promises might help you. I'm not sure yet about the blocking nature of JS for interface, but what you can do is the following: in handler, create a container and create a Promise to fill it – that Promise has to do the calculations; chain another Promise to it, it has to

[tw] Re: [TWC] How to delay the execution of a macro or a part of it

2017-07-10 Thread whatever
Hey, Yakov. My plugin processes parameters from internal tiddlers, no external resources required. It's called InfoboxTablesPlugin [1] and I use it to generate Wikipedia-style infoboxes. The current version that's publicly available is not the latest though. The new version supports modules and

[tw] Re: [TWC] How to delay the execution of a macro or a part of it

2017-07-10 Thread Yakov
Hello whatever, could you specify what kind of computation does this macro require? Does it make any requests to external sources? This may be of use: https://stackoverflow.com/questions/36588775/are-javascript-promise-asynchronous Best regards, Yakov. PS you may be interested in joining the

[tw] Re: [TWC] How to delay the execution of a macro or a part of it

2017-06-30 Thread whatever
Bump. On Thursday, June 22, 2017 at 5:48:38 PM UTC+2, whatever wrote: > > Hi! > I'm working on a plugin, which, depending on the amount of data it needs > to process, can take up to a minute to render. In the mean time, the TWC is > practically frozen. Is there any way to delay the processing