本文整理汇总了TypeScript中@ember/-internals/metal.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: computeLinkToComponentTransitioningIn
function computeLinkToComponentTransitioningIn(this: any) {
if (get(this, 'willBeActive') === true && !get(this, '_active')) {
return 'ember-transitioning-in';
} else {
return false;
}
}
示例2: computeLinkToComponentTransitioningOut
function computeLinkToComponentTransitioningOut(this: any) {
if (get(this, 'willBeActive') === false && get(this, '_active')) {
return 'ember-transitioning-out';
} else {
return false;
}
}
示例3: computeLinkToComponentLoading
function computeLinkToComponentLoading(this: any) {
let qualifiedRouteName = get(this, 'qualifiedRouteName');
let modelsAreLoaded = get(this, '_modelsAreLoaded');
if (!modelsAreLoaded || qualifiedRouteName === null || qualifiedRouteName === undefined) {
return get(this, 'loadingClass');
}
}
示例4: computed
willBeActive: computed('_routing.targetState', function computeLinkToComponentWillBeActive(
this: any
) {
let routing = this._routing;
let targetState = get(routing, 'targetState');
if (get(routing, 'currentState') === targetState) {
return;
}
return this._isActive(targetState);
}),
示例5: 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');
}
示例6: 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;
}
}
示例7: computeLinkToComponentActive
function computeLinkToComponentActive(this: any) {
let currentState = get(this, '_routing.currentState');
if (!currentState) {
return false;
}
return this._isActive(currentState);
}
示例8: compute
compute() {
let { _parentValue, _propertyKey } = this;
if (DEBUG) {
(this.tag.inner as TwoWayFlushDetectionTag).didCompute(_parentValue);
}
let parent: any;
let tracker: any;
if (EMBER_METAL_TRACKED_PROPERTIES) {
parent = getCurrentTracker();
tracker = setCurrentTracker();
}
let ret = get(_parentValue, _propertyKey);
if (EMBER_METAL_TRACKED_PROPERTIES) {
setCurrentTracker(parent!);
let tag = tracker!.combine();
if (parent) parent.add(tag);
this._propertyTag.inner.update(tag);
}
return ret;
}
示例9: isActiveForRoute
isActiveForRoute(
contexts: {}[],
queryParams: {},
routeName: string,
routerState: any,
isCurrentWhenSpecified: any
) {
let router = get(this, 'router');
let handlers = router._routerMicrolib.recognizer.handlersFor(routeName);
let leafName = handlers[handlers.length - 1].handler;
let maximumContexts = numberOfContextsAcceptedByHandler(routeName, handlers);
// NOTE: any ugliness in the calculation of activeness is largely
// due to the fact that we support automatic normalizing of
// `resource` -> `resource.index`, even though there might be
// dynamic segments / query params defined on `resource.index`
// which complicates (and makes somewhat ambiguous) the calculation
// of activeness for links that link to `resource` instead of
// directly to `resource.index`.
// if we don't have enough contexts revert back to full route name
// this is because the leaf route will use one of the contexts
if (contexts.length > maximumContexts) {
routeName = leafName;
}
return routerState.isActiveIntent(routeName, contexts, queryParams, !isCurrentWhenSpecified);
}
示例10: get
readValue = (args: any) => {
let valuePath = valuePathRef.value();
if (valuePath && args.length > 0) {
args[0] = get(args[0], valuePath as string);
}
return args;
};