Skip to content

Commit 5207a67

Browse files
committed
Kill Evented
1 parent 964e675 commit 5207a67

File tree

35 files changed

+129
-1002
lines changed

35 files changed

+129
-1002
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: 1 addition & 2 deletions
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",
@@ -400,4 +399,4 @@
400399
}
401400
},
402401
"packageManager": "[email protected]"
403-
}
402+
}

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

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

893-
on<Target>(
894-
name: string,
895-
target: Target,
896-
method: string | ((this: Target, ...args: any[]) => void)
897-
): this;
898-
on(name: string, method: ((...args: any[]) => void) | string): this;
899-
on(name: string, target: any, method?: any) {
900-
this._dispatcher?.setupHandlerForEmberEvent(name);
901-
// The `on` method here comes from the Evented mixin. Since this mixin
902-
// is applied to the parent of this class, however, we are still able
903-
// to use `super`.
904-
return super.on(name, target, method);
905-
}
906-
907893
// Changed to `rerender` on init
908894
_rerender() {
909895
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';
@@ -3154,52 +3153,6 @@ moduleFor(
31543153
runTask(() => set(this.context, 'foo', 5));
31553154
}
31563155

3157-
['@test triggering an event only attempts to invoke an identically named method, if it actually is a function (GH#15228)'](
3158-
assert
3159-
) {
3160-
assert.expect(3);
3161-
3162-
let payload = ['arbitrary', 'event', 'data'];
3163-
3164-
this.registerComponent('evented-component', {
3165-
ComponentClass: Component.extend({
3166-
someTruthyProperty: true,
3167-
3168-
init() {
3169-
this._super(...arguments);
3170-
this.trigger('someMethod', ...payload);
3171-
this.trigger('someTruthyProperty', ...payload);
3172-
},
3173-
3174-
someMethod(...data) {
3175-
assert.deepEqual(
3176-
data,
3177-
payload,
3178-
'the method `someMethod` should be called, when `someMethod` is triggered'
3179-
);
3180-
},
3181-
3182-
listenerForSomeMethod: on('someMethod', function (...data) {
3183-
assert.deepEqual(
3184-
data,
3185-
payload,
3186-
'the listener `listenerForSomeMethod` should be called, when `someMethod` is triggered'
3187-
);
3188-
}),
3189-
3190-
listenerForSomeTruthyProperty: on('someTruthyProperty', function (...data) {
3191-
assert.deepEqual(
3192-
data,
3193-
payload,
3194-
'the listener `listenerForSomeTruthyProperty` should be called, when `someTruthyProperty` is triggered'
3195-
);
3196-
}),
3197-
}),
3198-
});
3199-
3200-
this.render(`{{evented-component}}`);
3201-
}
3202-
32033156
['@test component yielding in an {{#each}} has correct block values after rerendering (GH#14284)']() {
32043157
this.registerComponent('list-items', {
32053158
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
@@ -85,35 +85,6 @@ moduleFor(
8585
}
8686
}
8787

88-
['@test event listeners are called when event is triggered'](assert) {
89-
let receivedEvent;
90-
let browserEvent;
91-
92-
this.registerComponent('x-button', {
93-
ComponentClass: Component.extend({
94-
tagName: 'button',
95-
init() {
96-
this._super();
97-
Object.keys(SUPPORTED_EMBER_EVENTS).forEach((browserEvent) => {
98-
this.on(SUPPORTED_EMBER_EVENTS[browserEvent], (event) => (receivedEvent = event));
99-
});
100-
},
101-
}),
102-
});
103-
104-
this.render(`{{x-button}}`);
105-
106-
let elementNode = this.$('button');
107-
let element = elementNode[0];
108-
109-
for (browserEvent in SUPPORTED_EMBER_EVENTS) {
110-
receivedEvent = null;
111-
runTask(() => triggerEvent(elementNode, browserEvent));
112-
assert.ok(receivedEvent, `${browserEvent} event was triggered`);
113-
assert.strictEqual(receivedEvent.target, element);
114-
}
115-
}
116-
11788
['@test events bubble view hierarchy for form elements'](assert) {
11889
let receivedEvent;
11990

0 commit comments

Comments
 (0)