How to use @glimmer/tracking - 2 common examples

To help you get started, we’ve selected a few @glimmer/tracking 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.js / packages / @glimmer / application / src / components / component-managers / custom.ts View on Github external
get(_target, prop) {
        if (capturedArgs.named.has(prop as string)) {
          let ref = capturedArgs.named.get(prop as string);
          consume(ref.tag);

          return ref.value();
        }
      },
github pzuraq / tracked-built-ins / addon / -private / decorator.ts View on Github external
function tracked(target: object, key: string, desc: PropertyDescriptor) {
  let initializer = (desc as any).initializer;
  let trackedDesc = glimmerTracked(target, key, desc);
  let { get: originalGet, set: originalSet } = trackedDesc;

  let defaultAssigned = new WeakSet();

  function set(this: any, value: unknown) {
    if (typeof value === 'object' && value !== null) {
      if (value instanceof Map) {
        value = new TrackedMap(value);
      } else if (value instanceof WeakMap) {
        value = new TrackedWeakMap();
      } else if (value instanceof Set) {
        value = new TrackedSet(value);
      } else if (value instanceof WeakSet) {
        value = new TrackedWeakSet();
      }
    }

@glimmer/tracking

Glimmer property tracking library

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular @glimmer/tracking functions