How to use the @glimmer/runtime.renderJitMain 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 / test-helpers / lib / environment / modes / lazy / environment.ts View on Github external
renderMain(
    template: Template,
    self: PathReference,
    builder: ElementBuilder
  ): TemplateIterator {
    let layout = template.asLayout();
    let handle = layout.compile(this.context);
    // TODO, figure out runtime program stuff
    return renderJitMain(
      { program: this.program, env: this, resolver: this.resolver },
      this.context,
      self,
      builder,
      handle
    );
  }
github glimmerjs / glimmer-vm / packages / @glimmer / integration-tests / lib / components / emberish-root-view.ts View on Github external
appendTo(selector: string) {
    let element = assertElement(document.querySelector(selector) as SimpleElement);
    let self = new UpdatableRootReference(this);
    let cursor = { element, nextSibling: null };

    let handle = unwrapTemplate(this.template)
      .asLayout()
      .compile(this.syntax);

    let templateIterator = renderJitMain(
      this.runtime,
      this.syntax,
      self,
      clientBuilder(this.runtime.env, cursor),
      unwrapHandle(handle)
    );
    let result;
    do {
      result = templateIterator.next();
    } while (!result.done);

    this.element = firstElementChild(element)!;
  }
}
github glimmerjs / glimmer-vm / packages / @glimmer / integration-tests / lib / modes / jit / render.ts View on Github external
export function renderTemplate(
  src: string,
  { runtime, syntax }: JitTestDelegateContext,
  self: VersionedPathReference,
  builder: ElementBuilder
): RenderResult {
  let template = preprocess(src);
  let handle = unwrapTemplate(template)
    .asLayout()
    .compile(syntax);

  let iterator = renderJitMain(runtime, syntax, self, builder, unwrapHandle(handle));
  return renderSync(runtime.env, iterator);
}
github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / render.ts View on Github external
export function renderTemplate(
  src: string,
  { runtime, syntax }: JitTestDelegateContext,
  self: PathReference,
  builder: ElementBuilder
): RenderResult {
  let template = preprocess(src);
  let iterator = renderJitMain(runtime, syntax, self, builder, template.asLayout().compile(syntax));
  return renderSync(runtime.env, iterator);
}
github glimmerjs / glimmer.js / packages / @glimmer / application / src / loaders / runtime-compiler / loader.ts View on Github external
async getTemplateIterator(
    app: Application,
    env: Environment,
    builder: ElementBuilder,
    dynamicScope: DynamicScope,
    self: PathReference
  ): Promise {
    let resolver = this.getResolver(app);
    let context = this.getContext(resolver);
    let runtime = CustomJitRuntime(resolver, context, app.env);

    let mainLayout = unwrapTemplate(templateFactory(mainTemplate).create());
    let handle = unwrapHandle(mainLayout.asLayout().compile(context));

    return Promise.resolve(
      renderJitMain(
        runtime,
        context,
        self,
        builder,
        handle,
        dynamicScope
      )
    );
  }