|
1 | 1 | import { action } from '@ember/object'; |
2 | | -import { addListener, removeListener, sendEvent } from '@ember/object/events'; |
3 | 2 | import { inject as service } from '@ember/service'; |
4 | 3 | import Component from '@glimmer/component'; |
5 | 4 | import { htmlSafe } from '@ember/template'; |
6 | 5 | import { schedule } from '@ember/runloop'; |
7 | 6 | import { tracked } from '@glimmer/tracking'; |
8 | | -import type { AnyFn } from 'ember/-private/type-utils'; |
9 | 7 |
|
10 | 8 | import type LayoutService from '../services/layout'; |
11 | 9 |
|
@@ -96,55 +94,4 @@ export default class ListContent extends Component<ListContentSignature> { |
96 | 94 | updateContentHeight(height: number) { |
97 | 95 | this.contentHeight = height; |
98 | 96 | } |
99 | | - |
100 | | - // Manually implement Evented functionality, so we can move away from the mixin |
101 | | - // TODO: Do we even need any evented-like things in this component? |
102 | | - |
103 | | - on(eventName: string, method: AnyFn): void; |
104 | | - on(eventName: string, target: unknown, method: AnyFn): void; |
105 | | - |
106 | | - @action |
107 | | - on(eventName: string, targetOrMethod: unknown | AnyFn, method?: AnyFn): void { |
108 | | - if (typeof targetOrMethod === 'function') { |
109 | | - // If we did not pass a target, default to `this` |
110 | | - addListener(this, eventName, this, targetOrMethod as AnyFn); |
111 | | - } else { |
112 | | - addListener(this, eventName, targetOrMethod, method!); |
113 | | - } |
114 | | - } |
115 | | - |
116 | | - one(eventName: string, method: AnyFn): void; |
117 | | - one(eventName: string, target: unknown, method: AnyFn): void; |
118 | | - |
119 | | - @action |
120 | | - one(eventName: string, targetOrMethod: unknown | AnyFn, method?: AnyFn) { |
121 | | - if (typeof targetOrMethod === 'function') { |
122 | | - // If we did not pass a target, default to `this` |
123 | | - addListener(this, eventName, this, targetOrMethod as AnyFn, true); |
124 | | - } else { |
125 | | - addListener(this, eventName, targetOrMethod, method!, true); |
126 | | - } |
127 | | - } |
128 | | - |
129 | | - off(eventName: string, method: AnyFn): void; |
130 | | - off(eventName: string, target: unknown, method: AnyFn): void; |
131 | | - |
132 | | - @action |
133 | | - off(eventName: string, targetOrMethod: unknown | AnyFn, method?: AnyFn) { |
134 | | - try { |
135 | | - if (typeof targetOrMethod === 'function') { |
136 | | - // If we did not pass a target, default to `this` |
137 | | - removeListener(this, eventName, this, targetOrMethod as AnyFn); |
138 | | - } else { |
139 | | - removeListener(this, eventName, targetOrMethod, method!); |
140 | | - } |
141 | | - } catch (e) { |
142 | | - console.error(e); |
143 | | - } |
144 | | - } |
145 | | - |
146 | | - @action |
147 | | - trigger(eventName: string, ...args: Array<any>) { |
148 | | - sendEvent(this, eventName, args); |
149 | | - } |
150 | 97 | } |
0 commit comments