本文整理汇总了TypeScript中ember-metal.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: computed
transitioningIn: computed('active', 'willBeActive', function computeLinkToComponentTransitioningIn(this: any) {
if (get(this, 'willBeActive') === true && !get(this, '_active')) {
return 'ember-transitioning-in';
} else {
return false;
}
}),
示例2: computeLinkToComponentQualifiedRouteName
function computeLinkToComponentQualifiedRouteName(this: any) {
let params = get(this, 'params');
let paramsLength = params.length;
let lastParam = params[paramsLength - 1];
if (lastParam && lastParam.isQueryParams) {
paramsLength--;
}
let onlyQueryParamsSupplied = (this[HAS_BLOCK] ? paramsLength === 0 : paramsLength === 1);
if (onlyQueryParamsSupplied) {
return get(this, '_routing.currentRouteName');
}
return get(this, 'targetRouteName');
}),
示例3: templateFor
templateFor(component: Component, env: Environment): OwnedTemplate {
let Template = get(component, 'layout');
let owner = component[OWNER];
if (Template) {
return env.getTemplate(Template, owner);
}
let layoutName = get(component, 'layoutName');
if (layoutName) {
let template = owner.lookup('template:' + layoutName);
if (template) {
return template;
}
}
return owner.lookup(DEFAULT_LAYOUT);
}
示例4: compute
compute() {
let { _parentReference, _parentObjectTag, _propertyKey } = this;
let parentValue = _parentReference.value();
_parentObjectTag.inner.update(tagForProperty(parentValue, _propertyKey));
let parentValueType = typeof parentValue;
if (parentValueType === 'string' && _propertyKey === 'length') {
return parentValue.length;
}
if ((parentValueType === 'object' && parentValue !== null) || parentValueType === 'function') {
if (DEBUG) {
watchKey(parentValue, _propertyKey);
}
if (DEBUG) {
(this.tag.inner as TwoWayFlushDetectionTag).didCompute(parentValue);
}
return get(parentValue, _propertyKey);
} else {
return undefined;
}
}
示例5: compute
compute() {
let { _parentReference, _parentObjectTag, _propertyKey } = this;
let parentValue = _parentReference.value();
_parentObjectTag.inner.update(tagForProperty(parentValue, _propertyKey));
let parentValueType = typeof parentValue;
if (parentValueType === 'string' && _propertyKey === 'length') {
return parentValue.length;
}
if (parentValueType === 'object' && parentValue !== null || parentValueType === 'function') {
if (MANDATORY_SETTER) {
watchKey(parentValue, _propertyKey);
}
if (EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER) {
this.tag.didCompute(parentValue);
}
return get(parentValue, _propertyKey);
} else {
return undefined;
}
}
示例6: iterate
iterate() {
let { ref, keyFor, valueTag } = this;
let iterable = ref.value();
valueTag.inner.update(tagForProperty(iterable, '[]'));
if (iterable === null || typeof iterable !== 'object') {
return EMPTY_ITERATOR;
}
if (Array.isArray(iterable)) {
return iterable.length > 0 ? new ArrayIterator(iterable, keyFor) : EMPTY_ITERATOR;
} else if (isEmberArray(iterable)) {
return get(iterable, 'length') > 0 ? new EmberArrayIterator(iterable, keyFor) : EMPTY_ITERATOR;
} else if (typeof iterable.forEach === 'function') {
let array: any[] = [];
iterable.forEach((item: any) => {
array.push(item);
});
return array.length > 0 ? new ArrayIterator(array, keyFor) : EMPTY_ITERATOR;
} else {
return EMPTY_ITERATOR;
}
}