How to use the @glimmer/reference.map function in @glimmer/reference

To help you get started, we’ve selected a few @glimmer/reference 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 emberjs / ember.js / packages / @ember / -internals / glimmer / lib / utils / bindings.ts View on Github external
install(
      _element: Simple.Element,
      component: Component,
      rootRef: RootReference,
      operations: ElementOperations
    ) {
      let componentMapStyleValue = (isVisible: boolean) => {
        return this.mapStyleValue(isVisible, component);
      };

      operations.setAttribute(
        'style',
        map(referenceForKey(rootRef, 'isVisible') as any, componentMapStyleValue),
        false,
        null
      );
      // // the upstream type for addDynamicAttribute's `value` argument
      // // appears to be incorrect. It is currently a Reference, I
      // // think it should be a Reference.
      // operations.addDynamicAttribute(element, 'style', ref as any as Reference, false);
    },
github glimmerjs / glimmer-vm / guides / tutorial / env.js View on Github external
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() };
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / syntax / functions.ts View on Github external
function helper(vm: PublicVM, args: IArguments) {
    let { env } = vm;
    let nameRef = args.positional.at(0);

    return map(nameRef, name => {
      if (typeof name === 'string' && name) {
        if (!env.hasPartial(name, templateMeta)) {
          throw new Error(`Could not find a partial named "${name}"`);
        }

        return env.lookupPartial(name, templateMeta);
      } else if (name) {
        throw new Error(`Could not find a partial named "${String(name)}"`);
      } else {
        return null;
      }
    });
  }
github glimmerjs / glimmer-vm / guides / tutorial / env.ts View on Github external
const increment: Helper = (args: VMArguments) => {
  return map(args.positional.at(0), (i: number) => i + 1);
};