@playableintelligence/template-host
v0.1.1
Published
Isomorphic, zero-dependency server/host helpers to inject template inputs into built template HTML and validate them against the schema.
Readme
@playableintelligence/template-host
Isomorphic, zero-dependency host helpers for serving asset-swappable templates in an iframe. Inject inputs into built template HTML and validate them against the emitted schema.
npm i @playableintelligence/template-hostimport { injectInputs, validateInputs } from "@playableintelligence/template-host";
const inputs = { PLAYER_FACE: { asset: "https://cdn/u123/face.glb" } };
if (validateInputs(schema, inputs).length === 0) {
res.end(injectInputs(builtTemplateHtml, inputs)); // the in-iframe SDK hydrates this
}Also: renderInputsScript, and postInputs (live updates from a parent frame).
Pairs with @playableintelligence/template-sdk. Proprietary — see LICENSE.
