How to use @glimmer/wire-format - 10 common examples

To help you get started, we’ve selected a few @glimmer/wire-format 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 / syntax / mount.ts View on Github external
params!.length === 1
  );

  if (DEBUG && hash) {
    let keys = hash[0];
    let extra = keys.filter(k => k !== 'model');

    assert(
      'You can only pass a `model` argument to the {{mount}} helper, ' +
        'e.g. {{mount "profile-engine" model=this.profile}}. ' +
        `You passed ${extra.join(',')}.`,
      extra.length === 0
    );
  }

  let expr: WireFormat.Expressions.Helper = [WireFormat.Ops.Helper, '-mount', params || [], hash];
  builder.dynamicComponent(expr, null, [], null, false, null, null);
  return true;
}
github emberjs / ember.js / packages / @ember / -internals / glimmer / lib / syntax / outlet.ts View on Github external
export function outletMacro(
  _name: string,
  params: Option,
  hash: Option,
  builder: OpcodeBuilder
) {
  let expr: WireFormat.Expressions.Helper = [WireFormat.Ops.Helper, '-outlet', params || [], hash];
  builder.dynamicComponent(expr, null, [], null, false, null, null);
  return true;
}
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / compiler.ts View on Github external
dynamic(name: string, value: FunctionExpression) {
    this.buffer.push([Ops.DynamicAttr, name, [Ops.ClientSideExpression, ClientSide.Ops.FunctionExpression, value], null]);
  }
}
github glimmerjs / glimmer-vm / packages / @glimmer / compiler / lib / javascript-compiler.ts View on Github external
dynamicAttr(name: str, namespace: str) {
    let value = this.popValue();
    this.push([Ops.DynamicAttr, name, value, namespace]);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / compiler / lib / javascript-compiler.ts View on Github external
staticAttr(name: str, namespace: str) {
    let value = this.popValue();
    this.push([Ops.StaticAttr, name, value, namespace]);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / compiler.ts View on Github external
static(name: string, value: string) {
    this.buffer.push([Ops.StaticAttr, name, value, null]);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / compiler / lib / javascript-compiler.ts View on Github external
append(trusted: boolean) {
    this.push([Ops.Append, this.popValue(), trusted]);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / compiler / lib / javascript-compiler.ts View on Github external
arg(path: string[]) {
    this.template.block.named.add(path[0]);
    this.pushValue([Ops.Arg, path]);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / compiler / lib / javascript-compiler.ts View on Github external
block(path: Path, template: number, inverse: number) {
    let params = this.popValue();
    let hash = this.popValue();

    let blocks = this.template.block.blocks;
    assert(typeof template !== 'number' || blocks[template] !== null, 'missing block in the compiler');
    assert(typeof inverse !== 'number' || blocks[inverse] !== null, 'missing block in the compiler');

    this.push([Ops.Block, path, params, hash, blocks[template], blocks[inverse]]);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / compiler / lib / javascript-compiler.ts View on Github external
closeElement(tag: str) {
    if (tag.indexOf('-') !== -1) {
      let component = this.endComponent();
      this.push([Ops.Component, tag, component]);
    } else {
      this.push([Ops.CloseElement]);
    }
  }