refactor(core): remove deprecated `ChangeDetectionRef` argument in `DifferFactory#create` (#18757)

BREAKING CHANGE: `DifferFactory.create` no longer takes ChangeDetectionRef as a first argument as it was not used and deprecated since v4.

PR Close #18757
This commit is contained in:
Olivier Combe 2017-08-17 15:01:32 +02:00 committed by Miško Hevery
parent 596e9f4e04
commit be9713c6e2
5 changed files with 3 additions and 35 deletions

View File

@ -8,8 +8,6 @@
import {looseIdentical, stringify} from '../../util'; import {looseIdentical, stringify} from '../../util';
import {isListLikeIterable, iterateListLike} from '../change_detection_util'; import {isListLikeIterable, iterateListLike} from '../change_detection_util';
import {ChangeDetectorRef} from '../change_detector_ref';
import {IterableChangeRecord, IterableChanges, IterableDiffer, IterableDifferFactory, NgIterable, TrackByFunction} from './iterable_differs'; import {IterableChangeRecord, IterableChanges, IterableDiffer, IterableDifferFactory, NgIterable, TrackByFunction} from './iterable_differs';
@ -17,14 +15,8 @@ export class DefaultIterableDifferFactory implements IterableDifferFactory {
constructor() {} constructor() {}
supports(obj: Object|null|undefined): boolean { return isListLikeIterable(obj); } supports(obj: Object|null|undefined): boolean { return isListLikeIterable(obj); }
create<V>(trackByFn?: TrackByFunction<V>): DefaultIterableDiffer<V>; create<V>(trackByFn?: TrackByFunction<V>): DefaultIterableDiffer<V> {
return new DefaultIterableDiffer<V>(trackByFn);
/**
* @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter
*/
create<V>(cdRefOrTrackBy?: ChangeDetectorRef|TrackByFunction<V>, trackByFn?: TrackByFunction<V>):
DefaultIterableDiffer<V> {
return new DefaultIterableDiffer<V>(trackByFn || <TrackByFunction<any>>cdRefOrTrackBy);
} }
} }

View File

@ -8,7 +8,6 @@
import {looseIdentical, stringify} from '../../util'; import {looseIdentical, stringify} from '../../util';
import {isJsObject} from '../change_detection_util'; import {isJsObject} from '../change_detection_util';
import {ChangeDetectorRef} from '../change_detector_ref';
import {KeyValueChangeRecord, KeyValueChanges, KeyValueDiffer, KeyValueDifferFactory} from './keyvalue_differs'; import {KeyValueChangeRecord, KeyValueChanges, KeyValueDiffer, KeyValueDifferFactory} from './keyvalue_differs';
@ -16,14 +15,7 @@ export class DefaultKeyValueDifferFactory<K, V> implements KeyValueDifferFactory
constructor() {} constructor() {}
supports(obj: any): boolean { return obj instanceof Map || isJsObject(obj); } supports(obj: any): boolean { return obj instanceof Map || isJsObject(obj); }
create<K, V>(): DefaultKeyValueDiffer<K, V>; create<K, V>(): KeyValueDiffer<K, V> { return new DefaultKeyValueDiffer<K, V>(); }
/**
* @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter
*/
create<K, V>(cd?: ChangeDetectorRef): KeyValueDiffer<K, V> {
return new DefaultKeyValueDiffer<K, V>();
}
} }
export class DefaultKeyValueDiffer<K, V> implements KeyValueDiffer<K, V>, KeyValueChanges<K, V> { export class DefaultKeyValueDiffer<K, V> implements KeyValueDiffer<K, V>, KeyValueChanges<K, V> {

View File

@ -7,7 +7,6 @@
*/ */
import {Optional, SkipSelf, StaticProvider} from '../../di'; import {Optional, SkipSelf, StaticProvider} from '../../di';
import {ChangeDetectorRef} from '../change_detector_ref';
/** /**
@ -127,12 +126,6 @@ export interface TrackByFunction<T> { (index: number, item: T): any; }
export interface IterableDifferFactory { export interface IterableDifferFactory {
supports(objects: any): boolean; supports(objects: any): boolean;
create<V>(trackByFn?: TrackByFunction<V>): IterableDiffer<V>; create<V>(trackByFn?: TrackByFunction<V>): IterableDiffer<V>;
/**
* @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter
*/
create<V>(_cdr?: ChangeDetectorRef|TrackByFunction<V>, trackByFn?: TrackByFunction<V>):
IterableDiffer<V>;
} }
/** /**

View File

@ -7,8 +7,6 @@
*/ */
import {Optional, SkipSelf, StaticProvider} from '../../di'; import {Optional, SkipSelf, StaticProvider} from '../../di';
import {ChangeDetectorRef} from '../change_detector_ref';
/** /**
@ -110,11 +108,6 @@ export interface KeyValueDifferFactory {
* Create a `KeyValueDiffer`. * Create a `KeyValueDiffer`.
*/ */
create<K, V>(): KeyValueDiffer<K, V>; create<K, V>(): KeyValueDiffer<K, V>;
/**
* @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter
*/
create<K, V>(_cdr?: ChangeDetectorRef): KeyValueDiffer<K, V>;
} }
/** /**

View File

@ -514,7 +514,6 @@ export interface IterableDiffer<V> {
/** @stable */ /** @stable */
export interface IterableDifferFactory { export interface IterableDifferFactory {
create<V>(trackByFn?: TrackByFunction<V>): IterableDiffer<V>; create<V>(trackByFn?: TrackByFunction<V>): IterableDiffer<V>;
/** @deprecated */ create<V>(_cdr?: ChangeDetectorRef | TrackByFunction<V>, trackByFn?: TrackByFunction<V>): IterableDiffer<V>;
supports(objects: any): boolean; supports(objects: any): boolean;
} }
@ -557,7 +556,6 @@ export interface KeyValueDiffer<K, V> {
/** @stable */ /** @stable */
export interface KeyValueDifferFactory { export interface KeyValueDifferFactory {
create<K, V>(): KeyValueDiffer<K, V>; create<K, V>(): KeyValueDiffer<K, V>;
/** @deprecated */ create<K, V>(_cdr?: ChangeDetectorRef): KeyValueDiffer<K, V>;
supports(objects: any): boolean; supports(objects: any): boolean;
} }