How to use the @glimmer/runtime.EMPTY_ARGS.positional 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 emberjs / ember.js / packages / @ember / -internals / glimmer / lib / syntax / mount.ts View on Github external
// that takes `PreparedArguments`
  if (args.named.has('model')) {
    assert('[BUG] this should already be checked by the macro', args.named.length === 1);

    let named = args.named.capture();
    let { tag } = named;

    // TODO delete me after EMBER_ROUTING_MODEL_ARG has shipped
    if (DEBUG && MODEL_ARG_NAME !== 'model') {
      assert('[BUG] named._map is not null', named['_map'] === null);
      named.names = [MODEL_ARG_NAME];
    }

    captured = {
      tag,
      positional: EMPTY_ARGS.positional,
      named,
      length: 1,
      value() {
        return {
          named: this.named.value(),
          positional: this.positional.value(),
        };
      },
    };
  }

  return new DynamicEngineReference(nameRef, env, captured);
}
github emberjs / ember.js / packages / @ember / -internals / glimmer / lib / syntax / outlet.ts View on Github external
env: Environment
  ) {
    // The router always dirties the root state.
    let tag = (this.tag = outletRef.tag);

    if (EMBER_ROUTING_MODEL_ARG) {
      let modelRef = new OutletModelReference(outletRef, env);
      let map = dict();
      map.model = modelRef;

      // TODO: the functionailty to create a proper CapturedArgument should be
      // exported by glimmer, or that it should provide an overload for `curry`
      // that takes `PreparedArguments`
      this.args = {
        tag,
        positional: EMPTY_ARGS.positional,
        named: {
          tag,
          map,
          names: ['model'],
          references: [modelRef],
          length: 1,
          has(key: string): boolean {
            return key === 'model';
          },
          get(key: string): T {
            return (key === 'model' ? modelRef : UNDEFINED_REFERENCE) as unsafe;
          },
          value(): Dict {
            let model = modelRef.value();
            return { model };
          },