Skip to content
Permalink
Browse files

refactor(core): remove deprecated `ChangeDetectionRef` argument in `D…

…ifferFactory#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
  • Loading branch information...
ocombe authored and mhevery committed Aug 17, 2017
1 parent 596e9f4 commit be9713c6e241834e45041aed781736a57b9789e7
@@ -8,23 +8,15 @@

import {looseIdentical, stringify} from '../../util';
import {isListLikeIterable, iterateListLike} from '../change_detection_util';
import {ChangeDetectorRef} from '../change_detector_ref';

import {IterableChangeRecord, IterableChanges, IterableDiffer, IterableDifferFactory, NgIterable, TrackByFunction} from './iterable_differs';


export class DefaultIterableDifferFactory implements IterableDifferFactory {
constructor() {}
supports(obj: Object|null|undefined): boolean { return isListLikeIterable(obj); }

create<V>(trackByFn?: TrackByFunction<V>): DefaultIterableDiffer<V>;

/**
* @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);
create<V>(trackByFn?: TrackByFunction<V>): DefaultIterableDiffer<V> {
return new DefaultIterableDiffer<V>(trackByFn);
}
}

@@ -8,22 +8,14 @@

import {looseIdentical, stringify} from '../../util';
import {isJsObject} from '../change_detection_util';
import {ChangeDetectorRef} from '../change_detector_ref';
import {KeyValueChangeRecord, KeyValueChanges, KeyValueDiffer, KeyValueDifferFactory} from './keyvalue_differs';


export class DefaultKeyValueDifferFactory<K, V> implements KeyValueDifferFactory {
constructor() {}
supports(obj: any): boolean { return obj instanceof Map || isJsObject(obj); }

create<K, V>(): 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>();
}
create<K, V>(): KeyValueDiffer<K, V> { return new DefaultKeyValueDiffer<K, V>(); }
}

export class DefaultKeyValueDiffer<K, V> implements KeyValueDiffer<K, V>, KeyValueChanges<K, V> {
@@ -7,7 +7,6 @@
*/

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 {
supports(objects: any): boolean;
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>;
}

/**
@@ -7,8 +7,6 @@
*/

import {Optional, SkipSelf, StaticProvider} from '../../di';
import {ChangeDetectorRef} from '../change_detector_ref';



/**
@@ -110,11 +108,6 @@ export interface KeyValueDifferFactory {
* Create a `KeyValueDiffer`.
*/
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>;
}

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

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

0 comments on commit be9713c

Please sign in to comment.
You can’t perform that action at this time.