Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*
* 1. The `RuntimeEnvironment` is the internal opauqe context used to evaluate
* compiled Glimmer programs. We need to instantiate it with:
*
* - the document we're rendering into
* - a function for extracting a protocol from a URL
* - TODO: explain or abstract iterable keys
*
* 2. We also need to supply a `RuntimeResolver`, the runtime counterpart to
* the compile-time `ResolverDelegate`. (Like the compile-time delegate,
* the runtime resolver currently doesn't do anything. Once it does,
* explain how the compile-time and runtime are meant to work together).
*
* 3. Finally, we need to rehydrate the compilation artifacts.
*/
let runtime = runtime_1.Runtime(document, payload, env_1.RUNTIME_RESOLVER);
/**
* Create an `UpdatableReference` for the value of `this` in the module. Using an
* UpdatableReference allows us to change it later and re-render the output.
*/
let state = object_reference_1.State({ suffix: '!', num: 5 });
/**
* Create a new element to render into.
*/
let element = document.createElement('main');
/**
* Create a cursor position for the rendering, which is just the element itself.
*/
let cursor = { element, nextSibling: null };
let iterator = runtime_1.renderAot(runtime, main, cursor, state);
let result = runtime_1.renderSync(runtime.env, iterator);
console.log(serialize(element));
*
* 1. The `RuntimeEnvironment` is the internal opauqe context used to evaluate
* compiled Glimmer programs. We need to instantiate it with:
*
* - the document we're rendering into
* - a function for extracting a protocol from a URL
* - TODO: explain or abstract iterable keys
*
* 2. We also need to supply a `RuntimeResolver`, the runtime counterpart to
* the compile-time `ResolverDelegate`. (Like the compile-time delegate,
* the runtime resolver currently doesn't do anything. Once it does,
* explain how the compile-time and runtime are meant to work together).
*
* 3. Finally, we need to rehydrate the compilation artifacts.
*/
let runtime = Runtime(document, payload, RUNTIME_RESOLVER);
/**
* Create an `UpdatableReference` for the value of `this` in the module. Using an
* UpdatableReference allows us to change it later and re-render the output.
*/
let state = State({ suffix: '!', num: 5 });
/**
* Create a new element to render into.
*/
let element = document.createElement('main');
/**
* Create a cursor position for the rendering, which is just the element itself.
*/
let cursor: Cursor = { element, nextSibling: null };