Skip to content

Commit 16e8ed7

Browse files
committed
Kill Evented
1 parent 2c64b52 commit 16e8ed7

File tree

35 files changed

+53
-1003
lines changed

35 files changed

+53
-1003
lines changed

broccoli/amd-compat-entrypoints/ember.debug.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,6 @@ d('@ember/object/computed', emberObjectComputed);
263263
import * as emberObjectCore from '@ember/object/core';
264264
d('@ember/object/core', emberObjectCore);
265265

266-
import * as emberObjectEvented from '@ember/object/evented';
267-
d('@ember/object/evented', emberObjectEvented);
268-
269266
import * as emberObjectEvents from '@ember/object/events';
270267
d('@ember/object/events', emberObjectEvents);
271268

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@
267267
"@ember/object/compat.js": "ember-source/@ember/object/compat.js",
268268
"@ember/object/computed.js": "ember-source/@ember/object/computed.js",
269269
"@ember/object/core.js": "ember-source/@ember/object/core.js",
270-
"@ember/object/evented.js": "ember-source/@ember/object/evented.js",
271270
"@ember/object/events.js": "ember-source/@ember/object/events.js",
272271
"@ember/object/index.js": "ember-source/@ember/object/index.js",
273272
"@ember/object/internals.js": "ember-source/@ember/object/internals.js",

packages/@ember/-internals/glimmer/lib/component.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -894,20 +894,6 @@ class Component<S = unknown>
894894
return this.__dispatcher;
895895
}
896896

897-
on<Target>(
898-
name: string,
899-
target: Target,
900-
method: string | ((this: Target, ...args: any[]) => void)
901-
): this;
902-
on(name: string, method: ((...args: any[]) => void) | string): this;
903-
on(name: string, target: any, method?: any) {
904-
this._dispatcher?.setupHandlerForEmberEvent(name);
905-
// The `on` method here comes from the Evented mixin. Since this mixin
906-
// is applied to the parent of this class, however, we are still able
907-
// to use `super`.
908-
return super.on(name, target, method);
909-
}
910-
911897
// Changed to `rerender` on init
912898
_rerender() {
913899
dirtyTag(this[DIRTY_TAG]);

packages/@ember/-internals/glimmer/tests/integration/components/append-test.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class AbstractAppendTest extends RenderingTestCase {
5656
}
5757
componentsByName[name] = this;
5858
pushHook('init');
59-
this.on('init', () => pushHook('on(init)'));
6059
}
6160

6261
didReceiveAttrs() {
@@ -148,12 +147,10 @@ class AbstractAppendTest extends RenderingTestCase {
148147
hooks,
149148
[
150149
['x-parent', 'init'],
151-
['x-parent', 'on(init)'],
152150
['x-parent', 'didReceiveAttrs'],
153151
['x-parent', 'willRender'],
154152
['x-parent', 'willInsertElement'],
155153
['x-child', 'init'],
156-
['x-child', 'on(init)'],
157154
['x-child', 'didReceiveAttrs'],
158155
['x-child', 'willRender'],
159156
['x-child', 'willInsertElement'],
@@ -299,7 +296,6 @@ class AbstractAppendTest extends RenderingTestCase {
299296
}
300297
componentsByName[name] = this;
301298
pushHook('init');
302-
this.on('init', () => pushHook('on(init)'));
303299
}
304300

305301
didReceiveAttrs() {
@@ -380,14 +376,7 @@ class AbstractAppendTest extends RenderingTestCase {
380376

381377
this.component = XParent.create({ foo: 'zomg' });
382378

383-
assert.deepEqual(
384-
hooks,
385-
[
386-
['x-parent', 'init'],
387-
['x-parent', 'on(init)'],
388-
],
389-
'creation of x-parent'
390-
);
379+
assert.deepEqual(hooks, [['x-parent', 'init']], 'creation of x-parent');
391380

392381
hooks.length = 0;
393382

@@ -399,7 +388,6 @@ class AbstractAppendTest extends RenderingTestCase {
399388
['x-parent', 'willInsertElement'],
400389

401390
['x-child', 'init'],
402-
['x-child', 'on(init)'],
403391
['x-child', 'didReceiveAttrs'],
404392
['x-child', 'willRender'],
405393
['x-child', 'willInsertElement'],

packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { run } from '@ember/runloop';
1414
import { DEBUG } from '@glimmer/env';
1515
import { tracked } from '@ember/-internals/metal';
1616
import { alias } from '@ember/object/computed';
17-
import { on } from '@ember/object/evented';
1817
import Service, { service } from '@ember/service';
1918
import EmberObject, { set, get, computed, observer } from '@ember/object';
2019
import { A as emberA } from '@ember/array';
@@ -3159,52 +3158,6 @@ moduleFor(
31593158
runTask(() => set(this.context, 'foo', 5));
31603159
}
31613160

3162-
['@test triggering an event only attempts to invoke an identically named method, if it actually is a function (GH#15228)'](
3163-
assert
3164-
) {
3165-
assert.expect(3);
3166-
3167-
let payload = ['arbitrary', 'event', 'data'];
3168-
3169-
this.registerComponent('evented-component', {
3170-
ComponentClass: Component.extend({
3171-
someTruthyProperty: true,
3172-
3173-
init() {
3174-
this._super(...arguments);
3175-
this.trigger('someMethod', ...payload);
3176-
this.trigger('someTruthyProperty', ...payload);
3177-
},
3178-
3179-
someMethod(...data) {
3180-
assert.deepEqual(
3181-
data,
3182-
payload,
3183-
'the method `someMethod` should be called, when `someMethod` is triggered'
3184-
);
3185-
},
3186-
3187-
listenerForSomeMethod: on('someMethod', function (...data) {
3188-
assert.deepEqual(
3189-
data,
3190-
payload,
3191-
'the listener `listenerForSomeMethod` should be called, when `someMethod` is triggered'
3192-
);
3193-
}),
3194-
3195-
listenerForSomeTruthyProperty: on('someTruthyProperty', function (...data) {
3196-
assert.deepEqual(
3197-
data,
3198-
payload,
3199-
'the listener `listenerForSomeTruthyProperty` should be called, when `someTruthyProperty` is triggered'
3200-
);
3201-
}),
3202-
}),
3203-
});
3204-
3205-
this.render(`{{evented-component}}`);
3206-
}
3207-
32083161
['@test component yielding in an {{#each}} has correct block values after rerendering (GH#14284)']() {
32093162
this.registerComponent('list-items', {
32103163
template: `{{#each this.items as |item|}}{{yield item}}{{/each}}`,

packages/@ember/-internals/glimmer/tests/integration/components/life-cycle-test.js

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ class LifeCycleHooksTest extends RenderingTestCase {
174174
assertNoElement('init', this);
175175
assertState('init', 'preRender', this);
176176

177-
this.on('init', () => pushHook('on(init)'));
178-
179177
schedule('afterRender', () => {
180178
this.isInitialRender = false;
181179
});
@@ -336,19 +334,16 @@ class LifeCycleHooksTest extends RenderingTestCase {
336334
// Sync hooks
337335

338336
['the-top', 'init'],
339-
['the-top', 'on(init)'],
340337
['the-top', 'didReceiveAttrs'],
341338
['the-top', 'willRender'],
342339
['the-top', 'willInsertElement'],
343340

344341
['the-middle', 'init'],
345-
['the-middle', 'on(init)'],
346342
['the-middle', 'didReceiveAttrs'],
347343
['the-middle', 'willRender'],
348344
['the-middle', 'willInsertElement'],
349345

350346
['the-bottom', 'init'],
351-
['the-bottom', 'on(init)'],
352347
['the-bottom', 'didReceiveAttrs'],
353348
['the-bottom', 'willRender'],
354349
['the-bottom', 'willInsertElement'],
@@ -368,15 +363,12 @@ class LifeCycleHooksTest extends RenderingTestCase {
368363
nonInteractive: [
369364
// Sync hooks
370365
['the-top', 'init'],
371-
['the-top', 'on(init)'],
372366
['the-top', 'didReceiveAttrs'],
373367

374368
['the-middle', 'init'],
375-
['the-middle', 'on(init)'],
376369
['the-middle', 'didReceiveAttrs'],
377370

378371
['the-bottom', 'init'],
379-
['the-bottom', 'on(init)'],
380372
['the-bottom', 'didReceiveAttrs'],
381373
],
382374
});
@@ -576,25 +568,21 @@ class LifeCycleHooksTest extends RenderingTestCase {
576568
// Sync hooks
577569

578570
['the-parent', 'init'],
579-
['the-parent', 'on(init)'],
580571
['the-parent', 'didReceiveAttrs'],
581572
['the-parent', 'willRender'],
582573
['the-parent', 'willInsertElement'],
583574

584575
['the-first-child', 'init'],
585-
['the-first-child', 'on(init)'],
586576
['the-first-child', 'didReceiveAttrs'],
587577
['the-first-child', 'willRender'],
588578
['the-first-child', 'willInsertElement'],
589579

590580
['the-second-child', 'init'],
591-
['the-second-child', 'on(init)'],
592581
['the-second-child', 'didReceiveAttrs'],
593582
['the-second-child', 'willRender'],
594583
['the-second-child', 'willInsertElement'],
595584

596585
['the-last-child', 'init'],
597-
['the-last-child', 'on(init)'],
598586
['the-last-child', 'didReceiveAttrs'],
599587
['the-last-child', 'willRender'],
600588
['the-last-child', 'willInsertElement'],
@@ -618,19 +606,15 @@ class LifeCycleHooksTest extends RenderingTestCase {
618606
// Sync hooks
619607

620608
['the-parent', 'init'],
621-
['the-parent', 'on(init)'],
622609
['the-parent', 'didReceiveAttrs'],
623610

624611
['the-first-child', 'init'],
625-
['the-first-child', 'on(init)'],
626612
['the-first-child', 'didReceiveAttrs'],
627613

628614
['the-second-child', 'init'],
629-
['the-second-child', 'on(init)'],
630615
['the-second-child', 'didReceiveAttrs'],
631616

632617
['the-last-child', 'init'],
633-
['the-last-child', 'on(init)'],
634618
['the-last-child', 'didReceiveAttrs'],
635619
],
636620
});
@@ -890,19 +874,16 @@ class LifeCycleHooksTest extends RenderingTestCase {
890874
// Sync hooks
891875

892876
['the-top', 'init'],
893-
['the-top', 'on(init)'],
894877
['the-top', 'didReceiveAttrs'],
895878
['the-top', 'willRender'],
896879
['the-top', 'willInsertElement'],
897880

898881
['the-middle', 'init'],
899-
['the-middle', 'on(init)'],
900882
['the-middle', 'didReceiveAttrs'],
901883
['the-middle', 'willRender'],
902884
['the-middle', 'willInsertElement'],
903885

904886
['the-bottom', 'init'],
905-
['the-bottom', 'on(init)'],
906887
['the-bottom', 'didReceiveAttrs'],
907888
['the-bottom', 'willRender'],
908889
['the-bottom', 'willInsertElement'],
@@ -923,15 +904,12 @@ class LifeCycleHooksTest extends RenderingTestCase {
923904
// Sync hooks
924905

925906
['the-top', 'init'],
926-
['the-top', 'on(init)'],
927907
['the-top', 'didReceiveAttrs'],
928908

929909
['the-middle', 'init'],
930-
['the-middle', 'on(init)'],
931910
['the-middle', 'didReceiveAttrs'],
932911

933912
['the-bottom', 'init'],
934-
['the-bottom', 'on(init)'],
935913
['the-bottom', 'didReceiveAttrs'],
936914
],
937915
});
@@ -1071,17 +1049,12 @@ class LifeCycleHooksTest extends RenderingTestCase {
10711049
let initialHooks = () => {
10721050
let ret = [
10731051
['an-item', 'init'],
1074-
['an-item', 'on(init)'],
10751052
['an-item', 'didReceiveAttrs'],
10761053
];
10771054
if (this.isInteractive) {
10781055
ret.push(['an-item', 'willRender'], ['an-item', 'willInsertElement']);
10791056
}
1080-
ret.push(
1081-
['nested-item', 'init'],
1082-
['nested-item', 'on(init)'],
1083-
['nested-item', 'didReceiveAttrs']
1084-
);
1057+
ret.push(['nested-item', 'init'], ['nested-item', 'didReceiveAttrs']);
10851058
if (this.isInteractive) {
10861059
ret.push(['nested-item', 'willRender'], ['nested-item', 'willInsertElement']);
10871060
}
@@ -1177,13 +1150,11 @@ class LifeCycleHooksTest extends RenderingTestCase {
11771150
['nested-item', 'willClearRender'],
11781151

11791152
['no-items', 'init'],
1180-
['no-items', 'on(init)'],
11811153
['no-items', 'didReceiveAttrs'],
11821154
['no-items', 'willRender'],
11831155
['no-items', 'willInsertElement'],
11841156

11851157
['nested-item', 'init'],
1186-
['nested-item', 'on(init)'],
11871158
['nested-item', 'didReceiveAttrs'],
11881159
['nested-item', 'willRender'],
11891160
['nested-item', 'willInsertElement'],
@@ -1218,11 +1189,9 @@ class LifeCycleHooksTest extends RenderingTestCase {
12181189

12191190
nonInteractive: [
12201191
['no-items', 'init'],
1221-
['no-items', 'on(init)'],
12221192
['no-items', 'didReceiveAttrs'],
12231193

12241194
['nested-item', 'init'],
1225-
['nested-item', 'on(init)'],
12261195
['nested-item', 'didReceiveAttrs'],
12271196

12281197
['an-item', 'willDestroy'],

packages/@ember/-internals/glimmer/tests/integration/event-dispatcher-test.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -149,35 +149,6 @@ moduleFor(
149149
}
150150
}
151151

152-
['@test event listeners are called when event is triggered'](assert) {
153-
let receivedEvent;
154-
let browserEvent;
155-
156-
this.registerComponent('x-button', {
157-
ComponentClass: class extends Component {
158-
tagName = 'button';
159-
init() {
160-
super.init();
161-
Object.keys(SUPPORTED_EMBER_EVENTS).forEach((browserEvent) => {
162-
this.on(SUPPORTED_EMBER_EVENTS[browserEvent], (event) => (receivedEvent = event));
163-
});
164-
}
165-
},
166-
});
167-
168-
this.render(`{{x-button}}`);
169-
170-
let elementNode = this.$('button');
171-
let element = elementNode[0];
172-
173-
for (browserEvent in SUPPORTED_EMBER_EVENTS) {
174-
receivedEvent = null;
175-
runTask(() => triggerEvent(elementNode, browserEvent));
176-
assert.ok(receivedEvent, `${browserEvent} event was triggered`);
177-
assert.strictEqual(receivedEvent.target, element);
178-
}
179-
}
180-
181152
['@test events bubble view hierarchy for form elements'](assert) {
182153
let receivedEvent;
183154

packages/@ember/-internals/glimmer/tests/integration/syntax/each-test.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { moduleFor, RenderingTestCase, applyMixins, strip, runTask } from 'internal-test-helpers';
22

3-
import { notifyPropertyChange, on } from '@ember/-internals/metal';
3+
import { notifyPropertyChange } from '@ember/-internals/metal';
44
import { get, set, computed } from '@ember/object';
55
import { A as emberA } from '@ember/array';
66
import ArrayProxy from '@ember/array/proxy';
@@ -1116,22 +1116,6 @@ moduleFor(
11161116
}
11171117
);
11181118

1119-
moduleFor(
1120-
'Syntax test: {{#each}} with array proxies, content is updated after init',
1121-
class extends EachTest {
1122-
createList(items) {
1123-
let wrapped = emberA(items);
1124-
let proxy = ArrayProxy.extend({
1125-
setup: on('init', function () {
1126-
this.set('content', emberA(wrapped));
1127-
}),
1128-
}).create();
1129-
1130-
return { list: proxy, delegate: wrapped };
1131-
}
1132-
}
1133-
);
1134-
11351119
moduleFor(
11361120
'Syntax test: {{#each as}} undefined path',
11371121
class extends RenderingTestCase {

0 commit comments

Comments
 (0)