diff options
| -rw-r--r-- | app/realities.moon | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/realities.moon b/app/realities.moon index d83109c..d4713a0 100644 --- a/app/realities.moon +++ b/app/realities.moon @@ -1,27 +1,24 @@ import append, h1, h2, p, a, i, div, ol, li, br, hr, span, button, section, article from require 'app.component' -import compile from require 'duct_tape' local Diagram, o GRID_W = 50 GRID_H = 40 -on_client = (fn, ...) -> - switch MODE - when 'SERVER' +on_client = switch MODE + when 'SERVER' + import compile from require 'duct_tape' + (fn, ...) -> code = compile fn - warn code + -- warn code append "<script type=\"application/lua\"> local fn = #{code} fn(#{table.concat { ... }, ', '}) </script>" - when 'CLIENT' - fn ... + when 'CLIENT' + (fn, ...) -> fn ... -- script https://cdnjs.cloudflare.com/ajax/libs/svg.js/2.6.6/svg.min.js -on_client -> - js.global\alert 'hello world!' - if MODE == 'CLIENT' require 'svg.js' eval = js.global\eval @@ -124,7 +121,6 @@ figures = do 'justify-content': 'space-evenly' (...) -> div { :style, ... } - sources = do short = (id) => "#{id} #{@year}" long = => @names, " (#{@year}): ", (i @title), ", #{@published}" |
