aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2018-10-18 08:07:26 +0000
committers-ol <s-ol@users.noreply.github.com>2018-10-18 08:07:26 +0000
commit7f24616e36eb012e968112cdb104fa5d3f1d1934 (patch)
treeea207af9a6c491a2af20a6e985b1221b53eac8ef
parentfix server/duct_tape (diff)
downloadmmm-7f24616e36eb012e968112cdb104fa5d3f1d1934.tar.gz
mmm-7f24616e36eb012e968112cdb104fa5d3f1d1934.zip
fix realities
-rw-r--r--app/realities.moon18
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}"