diff --git a/packages/ember-glimmer/lib/component.js b/packages/ember-glimmer/lib/component.js index 01da92dab86..bd99576c863 100644 --- a/packages/ember-glimmer/lib/component.js +++ b/packages/ember-glimmer/lib/component.js @@ -637,7 +637,7 @@ const Component = CoreView.extend( readDOMAttr(name) { let element = getViewElement(this); return readDOMAttr(element, name); - } + }, /** The WAI-ARIA role of the control represented by this view. For example, a @@ -717,24 +717,7 @@ const Component = CoreView.extend( @public @since 1.13.0 */ - - /** - Called when the attributes passed into the component have been updated. - Called both during the initial render of a container and during a rerender. - Can be used in place of an observer; code placed here will be executed - every time any attribute updates. - @event didReceiveAttrs - @public - @since 1.13.0 - */ - - /** - Called after a component has been rendered, both on initial render and - in subsequent rerenders. - @method didRender - @public - @since 1.13.0 - */ + didReceiveAttrs() {}, /** Called after a component has been rendered, both on initial render and @@ -743,14 +726,7 @@ const Component = CoreView.extend( @public @since 1.13.0 */ - - /** - Called before a component has been rendered, both on initial render and - in subsequent rerenders. - @method willRender - @public - @since 1.13.0 - */ + didRender() {}, /** Called before a component has been rendered, both on initial render and @@ -759,6 +735,7 @@ const Component = CoreView.extend( @public @since 1.13.0 */ + willRender() {}, /** Called when the attributes passed into the component have been changed. @@ -767,14 +744,7 @@ const Component = CoreView.extend( @public @since 1.13.0 */ - - /** - Called when the attributes passed into the component have been changed. - Called only during a rerender, not during an initial render. - @event didUpdateAttrs - @public - @since 1.13.0 - */ + didUpdateAttrs() {}, /** Called when the component is about to update and rerender itself. @@ -783,14 +753,7 @@ const Component = CoreView.extend( @public @since 1.13.0 */ - - /** - Called when the component is about to update and rerender itself. - Called only during a rerender, not during an initial render. - @event willUpdate - @public - @since 1.13.0 - */ + willUpdate() {}, /** Called when the component has updated and rerendered itself. @@ -799,14 +762,14 @@ const Component = CoreView.extend( @public @since 1.13.0 */ + didUpdate() {}, /** - Called when the component has updated and rerendered itself. - Called only during a rerender, not during an initial render. - @event didUpdate + @event didDestroyElement @public - @since 1.13.0 + @since 2.13.0 */ + didDestroyElement() {} /** A component may contain a layout. A layout is a regular template but diff --git a/packages/ember-metal/tests/mixin/method_test.js b/packages/ember-metal/tests/mixin/method_test.js index bd123de794b..f645864f837 100644 --- a/packages/ember-metal/tests/mixin/method_test.js +++ b/packages/ember-metal/tests/mixin/method_test.js @@ -154,6 +154,18 @@ QUnit.test('_super from a first-of-two mixins with no superclass function does n ok(true); }); +QUnit.test('calling _super when there is no method on parent class is deprecated', function() { + expectDeprecation('Calling `_super` when there is no method on the parent class is deprecated.'); + + let MixinA = Mixin.create({}); + + let MixinB = Mixin.create(MixinA, { + foo() { + this._super(...arguments); + } + }); +}); + // .......................................................... // CONFLICTS // diff --git a/packages/ember-utils/lib/super.js b/packages/ember-utils/lib/super.js index ff9aeb94b86..621a99d25ae 100644 --- a/packages/ember-utils/lib/super.js +++ b/packages/ember-utils/lib/super.js @@ -1,3 +1,6 @@ +import { + deprecate, +} from 'ember-debug'; const HAS_SUPER_PATTERN = /\.(_super|call\(this|apply\(this)/; const fnToString = Function.prototype.toString; @@ -41,6 +44,12 @@ function hasSuper(func) { */ export function wrap(func, superFunc) { if (!hasSuper(func)) { + //console.info('super::wrap deprecate here'); + deprecate( + 'Calling `_super` when there is no method on the parent class is deprecated.', + false, + { id: 'ember-metal.missing-super', until: '3.0.0' } + ); return func; } // ensure an unwrapped super that calls _super is wrapped with a terminal _super