Skip to content

add a global config #11

@paulovieira

Description

@paulovieira

It makes sense to be able to set some global options. Two concrete examples that I encountered:

  1. arguments for the compiled idom render function

If the user prefers to use ctx as argument (for instance) instead of the default data, it is necessary to wrap the superviews template with <template>:

<template args="ctx">
    <div>
        hello {ctx.name}!
    </div>
</template>

If this was a config option, the user could simply do:

    <div>
        hello {ctx.name}!
    </div>
  1. Function prefix for the incremental dom calls

Currently superviews is calling the idom functions directly:

elementOpen("div");
elementClose("div");

If the user is including incremental dom via a browser script, it is easier to reference the functions from the "IncrementalDOM" object that is exposed globally

IncrementalDOM === window.IncrementalDOM; // true
IncrementalDOM.elementOpen("div");
IncrementalDOM.elementClose("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