How to use the @glimmer/runtime.JitRuntimeFromProgram 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 / packages / @glimmer / integration-tests / lib / modes / jit / delegate.ts View on Github external
export function JitDelegateContext(
  doc: SimpleDocument,
  resolver: TestJitRuntimeResolver,
  registry: TestJitRegistry
): JitTestDelegateContext {
  registerInternalHelper(registry, '-get-dynamic-var', getDynamicVar);
  let context = new TestJitCompilationContext(resolver, registry);
  let runtime = JitRuntimeFromProgram(doc, context.program(), resolver);
  let syntax = { program: context, macros: new TestMacros() };
  return { runtime, syntax };
}
github glimmerjs / glimmer-vm / packages / @glimmer / integration-tests / lib / modes / jit / test-context.ts View on Github external
export function JitTestContext(delegate: RuntimeEnvironmentDelegate = {}): TestContext {
  let resolver = new TestJitRuntimeResolver();
  let registry = resolver.registry;
  registerHelper(registry, 'hash', (_positional, named) => named);

  let context = new TestJitCompilationContext(resolver, registry);
  let syntax: SyntaxCompilationContext = { program: context, macros: new TestMacros() };
  let doc = document as SimpleDocument;

  let runtime = JitRuntimeFromProgram(
    document as SimpleDocument,
    context.program(),
    resolver,
    assign(
      {
        toBool: emberToBool,
      },
      delegate
    )
  );

  let root = document.getElementById('qunit-fixture')! as SimpleElement;

  return { resolver, registry, program: context, syntax, doc, root, runtime, env: runtime.env };
}