Skip to content

Wrapper? #5

@jongacnik

Description

@jongacnik

Curious if we need the wrapper function, instead of just directly exporting the class. Doing this would allow for easy extending:

var Nanopage = require('nanopage')

class Page extends Nanopage {
  formattedDate (state, value) {
    try {
      return someDateFormattingFunction('y-m-d', state.date)
    } catch (err) {
      return false
    }
  }
}

function view (state, emit) {
  var page = new Page(state)
  return html`<div>${page().formattedDate().value()}</div>`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions