当前位置: 首页>>代码示例>>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;未经允许,请勿转载。