choo components (#639)

* add components

* example: componentize header

* fix choo SSR

* example: componentize footer

* example: fix footer

* update component cache asserts

* componentize todos

* reorder example dir

* fix example tests

* fix dep check test

* Add garbage collection of unused components

* Apply args when calling identity

* update to new component preview

* update nanocomponent

* fix cache err name

* remove static methods from example

* restore app.emit() function

* public API tests

* offset component cache iteration by 2

* whitelist contents of component folder (#643)

* allow lru number arg

* fix lint typo
This commit is contained in:
Yoshua Wuyts
2018-03-30 18:19:06 +02:00
committed by GitHub
parent 357d50871e
commit bddcfbe838
17 changed files with 411 additions and 259 deletions
+21
View File
@@ -0,0 +1,21 @@
var html = require('bel') // cannot require choo/html because it's a nested repo
var Header = require('../components/header')
var Footer = require('../components/footer')
var Todos = require('../components/todos')
var Info = require('../components/info')
module.exports = mainView
function mainView (state, emit) {
return html`
<body>
<section class="todoapp">
${state.cache(Header, 'header').render()}
${state.cache(Todos, 'todos').render()}
${state.cache(Footer, 'footer').render()}
</section>
${state.cache(Info, 'info').render()}
</body>
`
}