From dacc8296bc2cea87a726a71ef15baa26e9176c4e Mon Sep 17 00:00:00 2001 From: s-ol Date: Thu, 12 Jul 2018 00:37:51 +0200 Subject: towards env-agnostic component.moon --- app/component.moon | 2 +- app/todo.moon | 7 +++---- dist | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/component.moon b/app/component.moon index f0bc77f..fc29f8c 100644 --- a/app/component.moon +++ b/app/component.moon @@ -95,7 +95,7 @@ class ReactiveElement table.insert @_subscriptions, child\subscribe (...) -> @append ... child = child\get! if 'string' == type child - print 'WARN: string from ReactiveVar implicitly converted to TextNode, updating may fail' + warn 'string from ReactiveVar implicitly converted to TextNode, updating may fail' child = asnode child ok, last = pcall asnode, last diff --git a/app/todo.moon b/app/todo.moon index a464d0d..5bf4fef 100644 --- a/app/todo.moon +++ b/app/todo.moon @@ -1,5 +1,4 @@ -{ :document } = js.global -import ReactiveVar, text, div, form, span, h3, a, input, textarea, button from require './component.moon' +import ReactiveVar, append, text, div, form, span, h3, a, input, textarea, button from require './component.moon' parent = div! todoItem = (desc, done) -> @@ -30,5 +29,5 @@ form = with form { \append input type: 'text', value: desc, onchange: (e) => desc\set e.target.value \append input type: 'submit', value: 'add' -document.body\appendChild parent.node -document.body\appendChild form.node +append parent +append form diff --git a/dist b/dist index 6462cfe..f0700a9 160000 --- a/dist +++ b/dist @@ -1 +1 @@ -Subproject commit 6462cfe7581ed71780de1b5572192de85b07afe8 +Subproject commit f0700a9c142f4bd1f8404e6977e01c82e0ded245 -- cgit v1.2.3