本文整理匯總了TypeScript中ember-utils.isProxy函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isProxy函數的具體用法?TypeScript isProxy怎麽用?TypeScript isProxy使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isProxy函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: toBool
toBool(predicate: Opaque) {
if (isProxy(predicate)) {
this.objectTag.inner.update(tagForProperty(predicate, 'isTruthy'));
return get(predicate, 'isTruthy');
} else {
this.objectTag.inner.update(tagFor(predicate));
return emberToBool(predicate);
}
}
示例2: create
static create(reference: VersionedReference<Opaque>): VersionedReference<boolean> {
if (isConst(reference)) {
let value = reference.value();
if (isProxy(value)) {
return new RootPropertyReference(value, 'isTruthy') as VersionedReference<any>;
} else {
return PrimitiveReference.create(emberToBool(value));
}
}
return new ConditionalReference(reference);
}
示例3: 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();
}
}
示例4: tagForProperty
export function tagForProperty(object: any, propertyKey: string | symbol, _meta?: Meta): Tag {
if (typeof object !== 'object' || object === null) {
return CONSTANT_TAG;
}
let meta = _meta === undefined ? metaFor(object) : _meta;
if (isProxy(object)) {
return tagFor(object, meta);
}
let tags = meta.writableTags();
let tag = tags[propertyKey];
if (tag) {
return tag;
}
if (EMBER_METAL_TRACKED_PROPERTIES) {
let pair = combine([makeTag(), UpdatableTag.create(CONSTANT_TAG)]);
return (tags[propertyKey] = pair);
} else {
return (tags[propertyKey] = makeTag());
}
}