haskell - How to reload updated file in Threepenny-gui 0.6? -


the threepenny-gui changelog (https://hackage.haskell.org/package/threepenny-gui-0.6.0.1/changelog) reads: "the functions loadfile , loaddirectory have been removed, felt jsstatic option sufficient use cases."

my question is: how can reload image updated during execution without loadfile?

with threepenny-gui 0.5 used following code:

redraw :: ui.element -> ioref comptree -> (maybe vertex) -> ui () redraw img treeref mcv   = tree <- ui.liftio $ readioref treeref        ui.liftio $ writefile ".hoed/debugtree.dot" (shw $ summarize tree mcv)        ui.liftio $ system $ "dot -tpng -gsize=9,5 -gdpi=100 .hoed/debugtree.dot "                           ++ "> .hoed/wwwroot/debugtree.png"        url <- ui.loadfile "image/png" ".hoed/wwwroot/debugtree.png"        ui.element img # ui.set ui.src url 

when, threepenny-gui 0.6, set jsstatic just "./.hoed/wwwroot", following code (obviously) results in gui showing initial image there when application started:

redraw :: ui.element -> ioref comptree -> (maybe vertex) -> ui () redraw img treeref mcv   = tree <- ui.liftio $ readioref treeref        ui.liftio $ writefile ".hoed/debugtree.dot" (shw $ summarize tree mcv)        ui.liftio $ system $ "dot -tpng -gsize=9,5 -gdpi=100 .hoed/debugtree.dot "                           ++ "> .hoed/wwwroot/debugtree.png"        ui.element img # ui.set ui.src "static/debugtree.png"        return () 

my full code threepenny-gui 0.5 here: https://github.com/maartenfaddegon/hoed/blob/master/debug/hoed/demogui.hs

(author here.) apparently, didn't consider use case when removing these functions. :-) can add them in if like, make issue on github?

there various methods on javascript side reload file @ url. see instance question "refresh image new 1 @ same url".


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -