How to use the @glimmer/interfaces.Op.DynamicAttr function in @glimmer/interfaces

To help you get started, we’ve selected a few @glimmer/interfaces 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 / debug / lib / opcode-metadata.ts View on Github external
type: 'str',
    },
    {
      name: 'value',
      type: 'str',
    },
    {
      name: 'namespace',
      type: 'option-str',
    },
  ],
  operands: 3,
  check: true,
};

METADATA[Op.DynamicAttr] = {
  name: 'DynamicAttr',
  mnemonic: 'apnd_dynattr',
  before: null,
  stackChange: -1,
  ops: [
    {
      name: 'name',
      type: 'str',
    },
    {
      name: 'trusting',
      type: 'bool',
    },
    {
      name: 'namespace',
      type: 'option-str',
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / syntax / statements.ts View on Github external
STATEMENTS.add(SexpOpcodes.DynamicAttr, ([, name, value, namespace]) => [
  op('Expr', value),
  op(Op.DynamicAttr, name, false, namespace),
]);
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / syntax / statements.ts View on Github external
STATEMENTS.add(SexpOpcodes.TrustingDynamicAttr, ([, name, value, namespace]) => [
  op('Expr', value),
  op(Op.DynamicAttr, name, true, namespace),
]);
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / compiled / opcodes / dom.ts View on Github external
if (!validate(tag, lastUpdated)) {
      vm.env.scheduleUpdateModifier(modifier, manager);
      this.lastUpdated = value(tag);
    }
  }
}

APPEND_OPCODES.add(Op.StaticAttr, (vm, { op1: _name, op2: _value, op3: _namespace }) => {
  let name = vm[CONSTANTS].getString(_name);
  let value = vm[CONSTANTS].getString(_value);
  let namespace = _namespace ? vm[CONSTANTS].getString(_namespace) : null;

  vm.elements().setStaticAttribute(name, value, namespace);
});

APPEND_OPCODES.add(Op.DynamicAttr, (vm, { op1: _name, op2: trusting, op3: _namespace }) => {
  let name = vm[CONSTANTS].getString(_name);
  let reference = check(vm.stack.pop(), CheckReference);
  let value = reference.value();
  let namespace = _namespace ? vm[CONSTANTS].getString(_namespace) : null;

  let attribute = vm.elements().setDynamicAttribute(name, value, !!trusting, namespace);

  if (!isConst(reference)) {
    vm.updateWith(new UpdateDynamicAttributeOpcode(reference, attribute));
  }
});

export class UpdateDynamicAttributeOpcode extends UpdatingOpcode {
  public type = 'patch-element';

  public tag: Tag;