WS: improve Component class hierarchy
This commit is contained in:
parent
cc8ed1580c
commit
5929551b3b
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user