當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript meta.Meta類代碼示例

本文整理匯總了TypeScript中@ember/-internals/meta.Meta的典型用法代碼示例。如果您正苦於以下問題:TypeScript Meta類的具體用法?TypeScript Meta怎麽用?TypeScript Meta使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Meta類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

function mixinProperties<T extends MixinLike>(mixinsMeta: Meta, mixin: T): MixinLike {
  if (mixin instanceof Mixin) {
    if (mixinsMeta.hasMixin(mixin)) {
      return CONTINUE;
    }
    mixinsMeta.addMixin(mixin);
    return mixin.properties!;
  } else {
    return mixin; // apply anonymous mixin properties
  }
}
開發者ID:Turbo87,項目名稱:ember.js,代碼行數:11,代碼來源:mixin.ts

示例2: iterDeps

function iterDeps(
  method: (obj: object, key: string, meta: Meta) => void,
  obj: object,
  depKey: string,
  seen: Map<object, Set<string>>,
  meta: Meta
): void {
  let current = seen.get(obj);

  if (current === undefined) {
    current = new Set();
    seen.set(obj, current);
  }

  if (current.has(depKey)) {
    return;
  }

  let possibleDesc;
  meta.forEachInDeps(depKey, (key: string) => {
    possibleDesc = descriptorFor(obj, key, meta);

    if (possibleDesc !== undefined && possibleDesc._suspended === obj) {
      return;
    }

    method(obj, key, meta);
  });
}
開發者ID:kategengler,項目名稱:ember.js,代碼行數:29,代碼來源:property_events.ts

示例3: setup

 setup(obj: object, keyName: string, meta: Meta): void {
   assert(`Setting alias '${keyName}' on self`, this.altKey !== keyName);
   super.setup(obj, keyName, meta);
   if (meta.peekWatching(keyName) > 0) {
     this.consume(obj, keyName, meta);
   }
 }
開發者ID:Turbo87,項目名稱:ember.js,代碼行數:7,代碼來源:alias.ts

示例4: setup

  setup(obj: object, keyName: string, propertyDesc: PropertyDescriptor, meta: Meta): void {
    assert(`Setting alias '${keyName}' on self`, this.altKey !== keyName);
    super.setup(obj, keyName, propertyDesc, meta);

    if (!EMBER_METAL_TRACKED_PROPERTIES && meta.peekWatching(keyName) > 0) {
      this.consume(obj, keyName, meta);
    }
  }
開發者ID:emberjs,項目名稱:ember.js,代碼行數:8,代碼來源:alias.ts

示例5: unconsume

 unconsume(obj: object, keyName: string, meta: Meta): void {
   let wasConsumed = getCachedValueFor(obj, keyName) === CONSUMED;
   if (wasConsumed || meta.peekWatching(keyName) > 0) {
     removeDependentKeys(this, obj, keyName, meta);
   }
   if (wasConsumed) {
     getCacheFor(obj).delete(keyName);
   }
 }
開發者ID:cibernox,項目名稱:ember.js,代碼行數:9,代碼來源:alias.ts

示例6: notifyObservers

function notifyObservers(obj: object, keyName: string, meta: Meta): void {
  if (meta.isSourceDestroying()) {
    return;
  }

  let eventName = changeEvent(keyName);
  if (deferred > 0) {
    observerSet.add(obj, keyName, eventName);
  } else {
    sendEvent(obj, eventName, [obj, keyName]);
  }
}
開發者ID:kategengler,項目名稱:ember.js,代碼行數:12,代碼來源:property_events.ts

示例7: markObjectAsDirty

export function markObjectAsDirty(obj: object, propertyKey: string, meta: Meta): void {
  let objectTag = meta.readableTag();

  if (objectTag !== undefined) {
    if (isProxy(obj)) {
      (objectTag.inner! as any).first.inner.dirty();
    } else {
      (objectTag.inner! as any).dirty();
    }
  }

  let tags = meta.readableTags();
  let propertyTag = tags !== undefined ? tags[propertyKey] : undefined;

  if (propertyTag !== undefined) {
    dirty(propertyTag);
  }

  if (objectTag !== undefined || propertyTag !== undefined) {
    ensureRunloop();
  }
}
開發者ID:GreatWizard,項目名稱:ember.js,代碼行數:22,代碼來源:tags.ts

示例8: dependentKeysDidChange

// called whenever a property has just changed to update dependent keys
function dependentKeysDidChange(obj: object, depKey: string, meta: Meta): void {
  if (meta.isSourceDestroying() || !meta.hasDeps(depKey)) {
    return;
  }
  let seen = SEEN_MAP;
  let isTop = IS_TOP_SEEN_MAP;

  if (isTop) {
    IS_TOP_SEEN_MAP = false;
  }

  iterDeps(notifyPropertyChange, obj, depKey, seen, meta);

  if (isTop) {
    SEEN_MAP.clear();
    IS_TOP_SEEN_MAP = true;
  }
}
開發者ID:kategengler,項目名稱:ember.js,代碼行數:19,代碼來源:property_events.ts

示例9: removeDependentKeys

export function removeDependentKeys(
  desc: DescriptorWithDependentKeys,
  obj: object,
  keyName: string,
  meta: Meta
): void {
  // the descriptor has a list of dependent keys, so
  // remove all of its dependent keys.
  let depKeys = desc._dependentKeys;
  if (depKeys === null || depKeys === undefined) {
    return;
  }

  for (let idx = 0; idx < depKeys.length; idx++) {
    let depKey = depKeys[idx];
    // Decrement the number of times depKey depends on keyName.
    meta.writeDeps(depKey, keyName, meta.peekDeps(depKey, keyName) - 1);
    // Unwatch the depKey
    unwatch(obj, depKey, meta);
  }
}
開發者ID:GreatWizard,項目名稱:ember.js,代碼行數:21,代碼來源:dependent_keys.ts

示例10: overrideChains

function overrideChains(_obj: object, keyName: string, meta: Meta): void {
  let chainWatchers = meta.readableChainWatchers();
  if (chainWatchers !== undefined) {
    chainWatchers.revalidate(keyName);
  }
}
開發者ID:kategengler,項目名稱:ember.js,代碼行數:6,代碼來源:property_events.ts


注:本文中的@ember/-internals/meta.Meta類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。