jondashkyle / nanopage

super handy utilities for traversing flat content state
Apache License 2.0
42 stars 4 forks source link

Choo plugin #1

Closed jondashkyle closed 6 years ago

jondashkyle commented 6 years ago

Create a little Choo plugin which exposes a state.page function. You can then use that instead of instantiating .page with content state. For example:

function view (state, emit) {
  var children = state.page().children().toArray()
}
jongacnik commented 6 years ago

Yep, given current design, plugin could just look like

function plugin (state, emitter) {
  state.page = new Nanopage(state)
}
jondashkyle commented 6 years ago

Added in #8