Skip to content

Commit

Permalink
Remove deprecated 'property{Did,Will}Change'
Browse files Browse the repository at this point in the history
  • Loading branch information
btecu committed Oct 19, 2018
1 parent 333a67e commit d7f70c5
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 89 deletions.
2 changes: 0 additions & 2 deletions packages/@ember/-internals/metal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ export {
endPropertyChanges,
notifyPropertyChange,
overrideChains,
propertyDidChange,
propertyWillChange,
PROPERTY_DID_CHANGE,
} from './lib/property_events';
export { defineProperty, Descriptor } from './lib/properties';
Expand Down
55 changes: 0 additions & 55 deletions packages/@ember/-internals/metal/lib/property_events.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { descriptorFor, Meta, peekMeta } from '@ember/-internals/meta';
import { symbol } from '@ember/-internals/utils';
import { deprecate } from '@ember/debug';
import {
PROPERTY_DID_CHANGE as ENABLE_PROPERTY_DID_CHANGE,
PROPERTY_WILL_CHANGE as ENABLE_PROPERTY_WILL_CHANGE,
} from '@ember/deprecated-features';
import { DEBUG } from '@glimmer/env';
import changeEvent from './change_event';
import { sendEvent } from './events';
Expand All @@ -22,54 +17,6 @@ export const PROPERTY_DID_CHANGE = symbol('PROPERTY_DID_CHANGE');
const observerSet = new ObserverSet();
let deferred = 0;

// ..........................................................
// PROPERTY CHANGES
//

/**
@method propertyWillChange
@for Ember
@private
*/
let propertyWillChange;
if (ENABLE_PROPERTY_WILL_CHANGE) {
propertyWillChange = function propertyWillChange() {
deprecate(
`'propertyWillChange' is deprecated and has no effect. It is safe to remove this call.`,
false,
{
id: 'ember-metal.deprecate-propertyWillChange',
until: '3.5.0',
url:
'https://emberjs.com/deprecations/v3.x/#toc_use-notifypropertychange-instead-of-propertywillchange-and-propertydidchange',
}
);
};
}

/**
@method propertyDidChange
@for Ember
@private
*/
let propertyDidChange;
if (ENABLE_PROPERTY_DID_CHANGE) {
propertyDidChange = function propertyDidChange(obj: object, keyName: string, _meta: Meta) {
deprecate(
`'propertyDidChange' is deprecated in favor of 'notifyPropertyChange'. It is safe to change this call to 'notifyPropertyChange'.`,
false,
{
id: 'ember-metal.deprecate-propertyDidChange',
until: '3.5.0',
url:
'https://emberjs.com/deprecations/v3.x/#toc_use-notifypropertychange-instead-of-propertywillchange-and-propertydidchange',
}
);

notifyPropertyChange(obj, keyName, _meta);
};
}

/**
This function is called just after an object property has changed.
It will notify any observers and clear caches among other things.
Expand Down Expand Up @@ -247,8 +194,6 @@ function notifyObservers(obj: object, keyName: string, meta: Meta) {
}

export {
propertyWillChange,
propertyDidChange,
notifyPropertyChange,
overrideChains,
beginPropertyChanges,
Expand Down
16 changes: 0 additions & 16 deletions packages/@ember/-internals/runtime/tests/mixins/observable_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,5 @@ moduleFor(
obj.incrementProperty('age');
assert.equal(25, obj.get('age'));
}

['@test propertyWillChange triggers a deprecation warning']() {
let obj = EmberObject.create();

expectDeprecation(() => {
obj.propertyWillChange('foo');
}, /'propertyWillChange' is deprecated and has no effect. It is safe to remove this call./);
}

['@test propertyDidChange triggers a deprecation warning']() {
let obj = EmberObject.create();

expectDeprecation(() => {
obj.propertyDidChange('foo');
}, /'propertyDidChange' is deprecated in favor of 'notifyPropertyChange'. It is safe to change this call to 'notifyPropertyChange'./);
}
}
);
2 changes: 0 additions & 2 deletions packages/@ember/deprecated-features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ export const SEND_ACTION = !!'3.4.0';
export const EMBER_EXTEND_PROTOTYPES = !!'3.2.0-beta.5';
export const LOGGER = !!'3.2.0-beta.1';
export const POSITIONAL_PARAM_CONFLICT = !!'3.1.0-beta.1';
export const PROPERTY_WILL_CHANGE = !!'3.1.0-beta.1';
export const PROPERTY_DID_CHANGE = !!'3.1.0-beta.1';
export const ROUTER_ROUTER = !!'3.2.0-beta.1';
export const ARRAY_AT_EACH = !!'3.1.0-beta.1';
export const TARGET_OBJECT = !!'2.18.0-beta.1';
Expand Down
13 changes: 1 addition & 12 deletions packages/ember/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,7 @@ import Map from '@ember/map';
import MapWithDefault from '@ember/map/with-default';
import OrderedSet, { __OrderedSet__ } from '@ember/map/lib/ordered-set';
import { assign, merge } from '@ember/polyfills';
import {
PROPERTY_WILL_CHANGE,
PROPERTY_DID_CHANGE,
LOGGER,
EMBER_EXTEND_PROTOTYPES,
} from '@ember/deprecated-features';
import { LOGGER, EMBER_EXTEND_PROTOTYPES } from '@ember/deprecated-features';

// ****@ember/-internals/environment****

Expand Down Expand Up @@ -290,12 +285,6 @@ Ember.isNone = metal.isNone;
Ember.isEmpty = metal.isEmpty;
Ember.isBlank = metal.isBlank;
Ember.isPresent = metal.isPresent;
if (PROPERTY_WILL_CHANGE) {
Ember.propertyWillChange = metal.propertyWillChange;
}
if (PROPERTY_DID_CHANGE) {
Ember.propertyDidChange = metal.propertyDidChange;
}
Ember.notifyPropertyChange = metal.notifyPropertyChange;
Ember.overrideChains = metal.overrideChains;
Ember.beginPropertyChanges = metal.beginPropertyChanges;
Expand Down
2 changes: 0 additions & 2 deletions packages/ember/tests/reexports_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ let allExports = [
['run.throttle', '@ember/runloop', 'throttle'],
['run.currentRunLoop', '@ember/runloop', { get: 'getCurrentRunLoop' }],
['run.cancelTimers', '@ember/runloop', 'cancelTimers'],
['propertyWillChange', '@ember/-internals/metal'],
['propertyDidChange', '@ember/-internals/metal'],
['notifyPropertyChange', '@ember/-internals/metal'],
['overrideChains', '@ember/-internals/metal'],
['beginPropertyChanges', '@ember/-internals/metal'],
Expand Down

0 comments on commit d7f70c5

Please sign in to comment.