How to use the @glimmer/runtime.Lookup 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.ts View on Github external
constructor(options: TestEnvironmentOptions = {}) {
    // let document = options.document || window.document;
    // let appendOperations = options.appendOperations || new DOMTreeConstruction(document);
    super({
      appendOperations: options.appendOperations || new DOMTreeConstruction(options.document as Document || window.document),
      updateOperations: new DOMChanges((options.document || window.document) as Document)
    });

    // recursive field, so "unsafely" set one half late (but before the resolver is actually used)
    this.resolver['options'] = this.compileOptions;
    this.lookup = new LookupResolver(this.resolver);
    let document = options.document || window.document;

    this.uselessAnchor = document.createElement('a') as HTMLAnchorElement;
    this.registerHelper("if", ([cond, yes, no]) => cond ? yes : no);
    this.registerHelper("unless", ([cond, yes, no]) => cond ? no : yes);
    this.registerInternalHelper("-get-dynamic-var", getDynamicVar);
    this.registerModifier("action", new InertModifierManager());

    this.registerInternalHelper("hash", (_vm: VM, args: Arguments) => args.capture().named);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / environment.ts View on Github external
}

      return false;
    });
  }
}

export class TestEnvironment extends Environment {
  public resolver = new TestResolver();
  private program = new Program(this.resolver);
  private uselessAnchor: HTMLAnchorElement;
  public compiledLayouts = dict();
  private lookup: LookupResolver;

  public compileOptions: TemplateOptions = {
    lookup: new LookupResolver(this.resolver),
    program: this.program,
    macros: new TestMacros(),
    Builder: LazyOpcodeBuilder
  };

  constructor(options: TestEnvironmentOptions = {}) {
    // let document = options.document || window.document;
    // let appendOperations = options.appendOperations || new DOMTreeConstruction(document);
    super({
      appendOperations: options.appendOperations || new DOMTreeConstruction(options.document as Document || window.document),
      updateOperations: new DOMChanges((options.document || window.document) as Document)
    });

    // recursive field, so "unsafely" set one half late (but before the resolver is actually used)
    this.resolver['options'] = this.compileOptions;
    this.lookup = new LookupResolver(this.resolver);