本文整理匯總了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);
}
}