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 {
|
export class Component extends Observable {
|
||||||
|
|
||||||
constructor (parent) {
|
constructor (channel) {
|
||||||
super();
|
super(null);
|
||||||
this._parent = parent;
|
this._channel = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
get channel () {
|
get channel () {
|
||||||
return this._parent.channel;
|
return this._channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
on (property, callback) {
|
on (property, callback) {
|
||||||
@ -58,20 +58,20 @@ export class Component extends Observable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RootComponent extends Component {
|
export class ChildComponent extends Component {
|
||||||
|
|
||||||
constructor (channel) {
|
constructor (parent) {
|
||||||
super(null);
|
super();
|
||||||
this._channel = channel;
|
this._parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
get channel () {
|
get channel () {
|
||||||
return this._channel;
|
return this._parent.channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AddressableComponent extends Component {
|
export class AddressableComponent extends ChildComponent {
|
||||||
|
|
||||||
constructor (parent, addr) {
|
constructor (parent, addr) {
|
||||||
super(parent);
|
super(parent);
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 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 { StateNode } from '../base/protocol.js';
|
||||||
import { Strip } from './strip.js';
|
import { Strip } from './strip.js';
|
||||||
|
|
||||||
export class Mixer extends RootComponent {
|
export class Mixer extends Component {
|
||||||
|
|
||||||
constructor (channel) {
|
constructor (channel) {
|
||||||
super(channel);
|
super(channel);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 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 { StateNode } from '../base/protocol.js';
|
||||||
|
|
||||||
const NodeToProperty = Object.freeze({
|
const NodeToProperty = Object.freeze({
|
||||||
@ -26,7 +26,7 @@ const NodeToProperty = Object.freeze({
|
|||||||
[StateNode.TRANSPORT_RECORD] : 'record'
|
[StateNode.TRANSPORT_RECORD] : 'record'
|
||||||
});
|
});
|
||||||
|
|
||||||
export class Transport extends RootComponent {
|
export class Transport extends Component {
|
||||||
|
|
||||||
constructor (channel) {
|
constructor (channel) {
|
||||||
super(channel);
|
super(channel);
|
||||||
|
Loading…
Reference in New Issue
Block a user