本文整理汇总了TypeScript中@ember/-internals/utils.isProxy函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isProxy函数的具体用法?TypeScript isProxy怎么用?TypeScript isProxy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isProxy函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: toBool
toBool(predicate: Opaque) {
if (isProxy(predicate)) {
this.objectTag.inner.update(tagForProperty(predicate, 'isTruthy'));
return get(predicate as object, '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());
}
}
示例5: tagForProperty
export function tagForProperty(object: any, propertyKey: string | symbol, _meta?: Meta): Tag {
let objectType = typeof object;
if (objectType !== 'function' && (objectType !== 'object' || object === null)) {
return CONSTANT_TAG;
}
let meta = _meta === undefined ? metaFor(object) : _meta;
if (EMBER_METAL_TRACKED_PROPERTIES) {
if (!(propertyKey in object) && typeof object[UNKNOWN_PROPERTY_TAG] === 'function') {
return object[UNKNOWN_PROPERTY_TAG](propertyKey);
}
} else 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)]);
if (DEBUG) {
if (EMBER_METAL_TRACKED_PROPERTIES) {
setupMandatorySetter!(object, propertyKey);
}
(pair as any)._propertyKey = propertyKey;
}
return (tags[propertyKey] = pair);
} else {
return (tags[propertyKey] = makeTag());
}
}