From c4ead80613c405175ac1a44e6b54dc84b9c768b2 Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Sun, 14 Jun 2020 13:04:43 +0200 Subject: [PATCH] Extend 1de0542 Make Mixer and Transport subclasses of ChildComponent --- share/web_surfaces/shared/ardour.js | 4 ++-- share/web_surfaces/shared/base/component.js | 8 ++------ share/web_surfaces/shared/components/mixer.js | 8 ++++---- share/web_surfaces/shared/components/transport.js | 8 ++++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/share/web_surfaces/shared/ardour.js b/share/web_surfaces/shared/ardour.js index 2626768e50..8d682d0779 100644 --- a/share/web_surfaces/shared/ardour.js +++ b/share/web_surfaces/shared/ardour.js @@ -32,8 +32,8 @@ export default class ArdourClient extends Component { super(new MessageChannel(getOption(options, 'host', location.host))); if (getOption(options, 'components', true)) { - this._mixer = new Mixer(this.channel); - this._transport = new Transport(this.channel); + this._mixer = new Mixer(this); + this._transport = new Transport(this); this._components = [this._mixer, this._transport]; } else { this._components = []; diff --git a/share/web_surfaces/shared/base/component.js b/share/web_surfaces/shared/base/component.js index cbd26895c9..5f9fc30e0c 100644 --- a/share/web_surfaces/shared/base/component.js +++ b/share/web_surfaces/shared/base/component.js @@ -22,7 +22,7 @@ import Observable from './observable.js'; export class Component extends Observable { constructor (channel) { - super(null); + super(); this._channel = channel; } @@ -65,14 +65,10 @@ export class Component extends Observable { export class ChildComponent extends Component { constructor (parent) { - super(); + super(parent.channel); this._parent = parent; } - get channel () { - return this._parent.channel; - } - } export class AddressableComponent extends ChildComponent { diff --git a/share/web_surfaces/shared/components/mixer.js b/share/web_surfaces/shared/components/mixer.js index 18488d68ec..ed12f656e7 100644 --- a/share/web_surfaces/shared/components/mixer.js +++ b/share/web_surfaces/shared/components/mixer.js @@ -16,14 +16,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -import { Component } from '../base/component.js'; +import { ChildComponent } from '../base/component.js'; import { StateNode } from '../base/protocol.js'; import Strip from './strip.js'; -export default class Mixer extends Component { +export default class Mixer extends ChildComponent { - constructor (channel) { - super(channel); + constructor (parent) { + super(parent); this._strips = {}; this._ready = false; } diff --git a/share/web_surfaces/shared/components/transport.js b/share/web_surfaces/shared/components/transport.js index bc0e177103..a4087b90b9 100644 --- a/share/web_surfaces/shared/components/transport.js +++ b/share/web_surfaces/shared/components/transport.js @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -import { Component } from '../base/component.js'; +import { ChildComponent } from '../base/component.js'; import { StateNode } from '../base/protocol.js'; const NodeToProperty = Object.freeze({ @@ -26,10 +26,10 @@ const NodeToProperty = Object.freeze({ [StateNode.TRANSPORT_RECORD] : 'record' }); -export default class Transport extends Component { +export default class Transport extends ChildComponent { - constructor (channel) { - super(channel); + constructor (parent) { + super(parent); this._time = 0; this._tempo = 0; this._roll = false;