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