Open jongacnik opened 6 years ago
Allow a second argument into page to define a dynamic/fallback content entry. Example in context of choo:
page
choo
var page = require('nanopage') var p = page(state.href, { source: `/bundles/${state.params.id}.json`, loaded: false })
This allows for pages to be added dynamically to state. Logic under the hood is something like:
function page (key, dynamic) { var content = state.content[key] if (!content && dynamic) { state.content[key] = dynamic content = state.content[key] } return content }
That second param could also be a function:
var p = page(state.href, key => ({ source: `/bundles/${state.params.id}.json`, loaded: false }))
@s3ththompson
Allow a second argument into
page
to define a dynamic/fallback content entry. Example in context ofchoo
:This allows for pages to be added dynamically to state. Logic under the hood is something like:
That second param could also be a function:
@s3ththompson