How to use the @glimmer/reference.createUpdatableTag 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 / metal / lib / chain-tags.ts View on Github external
// the CP is still valid, and if so we use the cached value. If not, then
      // we create a lazy chain lookup, and the next time the CP is caluculated,
      // it will update that lazy chain.
      let lastRevision = getLastRevisionFor(current, segment);

      if (validate(propertyTag, lastRevision)) {
        current = peekCacheFor(current).get(segment);
      } else {
        let lazyChains = metaFor(current).writableLazyChainsFor(segment);

        let rest = path.substr(segmentEnd + 1);

        let placeholderTag = lazyChains[rest];

        if (placeholderTag === undefined) {
          placeholderTag = lazyChains[rest] = createUpdatableTag();
        }

        chainTags.push(placeholderTag);

        break;
      }
    }
  }

  return chainTags;
}
github emberjs / ember.js / packages / @ember / -internals / meta / lib / meta.ts View on Github external
writableTag() {
    assert(
      this.isMetaDestroyed()
        ? `Cannot create a new tag for \`${toString(this.source)}\` after it has been destroyed.`
        : '',
      !this.isMetaDestroyed()
    );
    let ret = this._tag;
    if (ret === undefined) {
      ret = this._tag = createUpdatableTag();
    }
    return ret;
  }
github emberjs / ember.js / packages / @ember / -internals / glimmer / lib / helpers / get.ts View on Github external
constructor(
    sourceReference: VersionedPathReference,
    pathReference: PathReference
  ) {
    super();
    this.sourceReference = sourceReference;
    this.pathReference = pathReference;

    this.lastPath = null;
    this.innerReference = NULL_REFERENCE;

    let innerTag = (this.innerTag = createUpdatableTag());

    this.tag = combine([sourceReference.tag, pathReference.tag, innerTag]);
  }
github emberjs / ember.js / packages / @ember / -internals / glimmer / lib / helpers / if-unless.ts View on Github external
constructor(cond: any, truthy: any, falsy: any) {
    super();

    this.branchTag = createUpdatableTag();
    this.tag = combine([cond.tag, this.branchTag]);

    this.cond = cond;
    this.truthy = truthy;
    this.falsy = falsy;
  }
github emberjs / ember.js / packages / @ember / -internals / metal / lib / tags.ts View on Github external
if (objectType !== 'function' && (objectType !== 'object' || object === null)) {
    return CONSTANT_TAG;
  }
  let meta = _meta === undefined ? metaFor(object) : _meta;

  if (!(propertyKey in object) && typeof object[UNKNOWN_PROPERTY_TAG] === 'function') {
    return object[UNKNOWN_PROPERTY_TAG](propertyKey);
  }

  let tags = meta.writableTags();
  let tag = tags[propertyKey];
  if (tag) {
    return tag;
  }

  let newTag = createUpdatableTag();

  if (DEBUG) {
    setupMandatorySetter!(object, propertyKey);

    (newTag as any)._propertyKey = propertyKey;
  }

  return (tags[propertyKey] = newTag);
}