本文整理汇总了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
}
}
示例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);
});
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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]);
}
}
示例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();
}
}
示例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;
}
}
示例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);
}
}
示例10: overrideChains
function overrideChains(_obj: object, keyName: string, meta: Meta): void {
let chainWatchers = meta.readableChainWatchers();
if (chainWatchers !== undefined) {
chainWatchers.revalidate(keyName);
}
}