Tag provides a unified approach forrendering,
and only those four things.
Plainly, Tag is a trifecta of
designed to build expressive web applications.
Creates an custom, scoped HTML tag. Requires a selector: a CSS selector. An optional second argument may be passed for seeding the initial state.
It will return an object with the selector as an attribute and the following namespaced functions.
Expects a function that returns HTML as a string to be rendered into the provided target. A falsey return will leave the target node untouched. This function will be invoked whenever state changes.
Expects a CSS stylesheet as a string. The ampersand (&) symbol may be used to scope rulesets.
$.on(eventType: string, selector: string, function(event)) : function
An event delegator that expects three arguments. A css selector, and a handler. No selector will listen on the tag's root. Returns a function to remove the listener when invoked.
$.read() : object
Returns the current state.
$.write(payload [, function(state, payload)])
Merges the payload into the current state. An optional second argument for managing the state update may be provided. That function will be called with the current state and the payload. It expects the reconciled, complete state to be returned
Browser Support: The tail feature set for this application is ES Modules, which is supported by all modern browsers. For an entertaining summary, please refer to Making Future Interfaces: ES Modules.