本文整理匯總了TypeScript中rxjs/operator/distinctUntilChanged.distinctUntilChanged類的典型用法代碼示例。如果您正苦於以下問題:TypeScript distinctUntilChanged類的具體用法?TypeScript distinctUntilChanged怎麽用?TypeScript distinctUntilChanged使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了distinctUntilChanged類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: if
export function select<T, R>(pathOrMapFn: any, ...paths: string[]): Observable<R> {
let mapped$: Observable<R>;
if (typeof pathOrMapFn === 'string') {
mapped$ = pluck.call(this, pathOrMapFn, ...paths);
}
else if (typeof pathOrMapFn === 'function') {
mapped$ = map.call(this, pathOrMapFn);
}
else {
throw new TypeError(`Unexpected type ${ typeof pathOrMapFn } in select operator,`
+ ` expected 'string' or 'function'`);
}
return distinctUntilChanged.call(mapped$);
}
示例2: selectOperator
return function selectOperator(source$: Store<T>): Store<K> {
let mapped$: Store<any>;
if (typeof pathOrMapFn === 'string') {
mapped$ = pluck.call(source$, pathOrMapFn, ...paths);
} else if (typeof pathOrMapFn === 'function') {
mapped$ = map.call(source$, pathOrMapFn);
} else {
throw new TypeError(
`Unexpected type '${typeof pathOrMapFn}' in select operator,` +
` expected 'string' or 'function'`
);
}
return distinctUntilChanged.call(mapped$);
};
示例3: select
select(
pathOrMapFn: ((state: T) => any) | string,
...paths: string[]
): Store<any> {
let mapped$: Store<any>;
if (typeof pathOrMapFn === 'string') {
mapped$ = pluck.call(this, pathOrMapFn, ...paths);
} else if (typeof pathOrMapFn === 'function') {
mapped$ = map.call(this, pathOrMapFn);
} else {
throw new TypeError(
`Unexpected type '${typeof pathOrMapFn}' in select operator,` +
` expected 'string' or 'function'`
);
}
return distinctUntilChanged.call(mapped$);
}
示例4:
select<R>(pathOrMapFn: (state: T) => R): Observable<R> {
const mapped$: Observable<R> = map.call(this, pathOrMapFn);
return distinctUntilChanged.call(mapped$);
}