13
0

WS: improve Component class hierarchy

This commit is contained in:
Luciano Iam 2020-06-14 12:06:54 +02:00 committed by Robin Gareus
parent cc8ed1580c
commit 5929551b3b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 17 additions and 17 deletions

View File

@ -21,13 +21,13 @@ import { Observable } from './observable.js';
export class Component extends Observable {
constructor (parent) {
super();
this._parent = parent;
}
constructor (channel) {
super(null);
this._channel = channel;
}
get channel () {
return this._parent.channel;
return this._channel;
}
on (property, callback) {
@ -58,20 +58,20 @@ export class Component extends Observable {
}
export class RootComponent extends Component {
constructor (channel) {
super(null);
this._channel = channel;
}
export class ChildComponent extends Component {
constructor (parent) {
super();
this._parent = parent;
}
get channel () {
return this._channel;
return this._parent.channel;
}
}
export class AddressableComponent extends Component {
export class AddressableComponent extends ChildComponent {
constructor (parent, addr) {
super(parent);

View File

@ -16,11 +16,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import { RootComponent } from '../base/component.js';
import { Component } from '../base/component.js';
import { StateNode } from '../base/protocol.js';
import { Strip } from './strip.js';
export class Mixer extends RootComponent {
export class Mixer extends Component {
constructor (channel) {
super(channel);

View File

@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import { RootComponent } from '../base/component.js';
import { Component } from '../base/component.js';
import { StateNode } from '../base/protocol.js';
const NodeToProperty = Object.freeze({
@ -26,7 +26,7 @@ const NodeToProperty = Object.freeze({
[StateNode.TRANSPORT_RECORD] : 'record'
});
export class Transport extends RootComponent {
export class Transport extends Component {
constructor (channel) {
super(channel);