How to use the @glimmer/runtime.SimpleComponentManager function in @glimmer/runtime

To help you get started, we’ve selected a few @glimmer/runtime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glimmerjs / glimmer-vm / guides / tutorial / env.js View on Github external
const reference_1 = require("@glimmer/reference");
const runtime_1 = require("@glimmer/runtime");
exports.RUNTIME_RESOLVER = {
    resolve(handle) {
        if (handle >= TABLE.length) {
            throw new Error(`Unexpected handle ${handle}`);
        }
        else {
            return TABLE[handle];
        }
    },
};
const increment = (args) => {
    return reference_1.map(args.positional.at(0), (i) => i + 1);
};
const TEMPLATE_ONLY_COMPONENT = { state: null, manager: new runtime_1.SimpleComponentManager() };
const TABLE = [increment, TEMPLATE_ONLY_COMPONENT];
github glimmerjs / glimmer-vm / guides / tutorial / env.ts View on Github external
export const RUNTIME_RESOLVER = {
  resolve<u>(handle: number): U {
    if (handle &gt;= TABLE.length) {
      throw new Error(`Unexpected handle ${handle}`);
    } else {
      return TABLE[handle] as U;
    }
  },
};

const increment: Helper = (args: VMArguments) =&gt; {
  return map(args.positional.at(0), (i: number) =&gt; i + 1);
};

const TEMPLATE_ONLY_COMPONENT = { state: null, manager: new SimpleComponentManager() };
const TABLE: ResolvedValue[] = [increment, TEMPLATE_ONLY_COMPONENT];
</u>