Log of #mupdf at irc.freenode.net.

Search:
 <<<Back 1 day (to 2020/02/27)Fwd 1 day (to 2020/02/29)>>>20200228 
yulin724 sebras can you know how to use "task" library in mujs?10:47.05 
avih yulin724: this is a very vague question. what have you tried and where did it fail?10:55.47 
  the answer is probably "no, but he will if he'll have to use it"10:56.21 
yulin724 YuLinPro-5:examples yulin724$ ~/dev/mujs-1.0.6/build/release/mujs helloworld.jsReferenceError: 'module' is not definedat [string]:9at require ([string]:6)at helloworld.js:2YuLinPro-5:examples yulin724$10:56.36 
  there is no "module" defined.10:56.45 
avih correct, mujs is a ES5.1, and ES5.1 does not define modules.10:57.04 
  nevertheless, the mujs binary supports minimal implementation of require, which apparently is not enough for what "task" needs (i.e. the "module" identifier defined)10:57.42 
yulin724 got it.10:57.56 
avih it's possible to support a fully compliant CommonJS modules. you can look at mpv source code at player/javascript/defaults.js for such implementation10:58.48 
yulin724 and about "setTimeout", do you know how to implement it?10:59.15 
avih yes, look at the same source file i just pointed to10:59.33 
  but for that you need some events infrastructure, which mpv has, but the mujs binary doesn't. this would be harder to do at the mujs binary10:59.59 
yulin724 ok, let me check mpv. Thank you.11:00.45 
avih yulin724: modules https://github.com/mpv-player/mpv/blob/master/player/javascript/defaults.js#L445 and timers https://github.com/mpv-player/mpv/blob/master/player/javascript/defaults.js#L34311:01.52 
  (the code uses some mpv utilities which for the most part can be implemented in js too, except the timers where you need some sort of event loop to support)11:02.50 
  in general, the mpv binary is not a node.js replacement nor does it try to be. it supports the language (which doesn't specify timers), and a minimal implementation of require, and that's about it. you cannot expect it to replace node.js11:07.31 
  the mujs* binary11:07.36 
yulin724 I understand. because a c dynamic library I used have problem of calling another functional API in its callback, so I need a async task method to start a javascript function.11:10.41 
 <<<Back 1 day (to 2020/02/27)Forward 1 day (to 2020/02/29)>>> 
ghostscript.com #ghostscript
Search: