aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2018-10-15 05:15:34 +0000
committers-ol <s-ol@users.noreply.github.com>2018-10-15 05:15:34 +0000
commitac7e873595c93a996090632cfbdf2f47d5a4e2c4 (patch)
tree4501b4c90468f0a8053bf654932a36386738a234 /app
parenttape test (diff)
downloadmmm-ac7e873595c93a996090632cfbdf2f47d5a4e2c4.tar.gz
mmm-ac7e873595c93a996090632cfbdf2f47d5a4e2c4.zip
more tape
Diffstat (limited to 'app')
-rw-r--r--app/realities.moon16
-rw-r--r--app/test.moon4
2 files changed, 20 insertions, 0 deletions
diff --git a/app/realities.moon b/app/realities.moon
index 244cd41..d83109c 100644
--- a/app/realities.moon
+++ b/app/realities.moon
@@ -1,11 +1,27 @@
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'
+ code = compile fn
+ warn code
+ append "<script type=\"application/lua\">
+ local fn = #{code}
+ fn(#{table.concat { ... }, ', '})
+ </script>"
+ when 'CLIENT'
+ 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
diff --git a/app/test.moon b/app/test.moon
new file mode 100644
index 0000000..799ec03
--- /dev/null
+++ b/app/test.moon
@@ -0,0 +1,4 @@
+y = { :print }
+->
+ test with y
+ print