mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 17:47:16 +00:00
Expose children via js_getChildren
This commit is contained in:
parent
ae32220624
commit
416377fb1c
4 changed files with 13 additions and 9 deletions
|
|
@ -609,12 +609,9 @@ function DummyComponent({ makiObject }) {
|
|||
}
|
||||
|
||||
function MakiChildren({ makiObject }) {
|
||||
if (makiObject.children == null) {
|
||||
return null;
|
||||
}
|
||||
return makiObject.children.map((childMakiObject, i) => (
|
||||
<Maki key={i} makiObject={childMakiObject} />
|
||||
));
|
||||
return makiObject
|
||||
.js_getChildren()
|
||||
.map((childMakiObject, i) => <Maki key={i} makiObject={childMakiObject} />);
|
||||
}
|
||||
|
||||
// Given a skin XML node, pick which component to use, and render it.
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ async function parseChildren(node, children, zip, store) {
|
|||
childParser = noop;
|
||||
}
|
||||
const parsedChild = await childParser(child, node, zip, store);
|
||||
child.maki = parsedChild;
|
||||
if (child.children != null && child.children.length > 0) {
|
||||
await parseChildren(parsedChild, child.children, zip, store);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class Container extends MakiObject {
|
|||
getcurlayout() {
|
||||
unimplementedWarning("getcurlayout");
|
||||
// TODO: For now we just always show the first layout. I think that's the default.
|
||||
return this.children.find(childNode => {
|
||||
return this.js_getChildren().find(childNode => {
|
||||
return childNode.getclassname() === "Layout";
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import Emitter from "../Emitter";
|
||||
import * as Utils from "../utils";
|
||||
import { ModernStore, ResolvedXmlNode } from "../types";
|
||||
import { ModernStore, XmlNode } from "../types";
|
||||
|
||||
class MakiObject {
|
||||
_node: XmlNode;
|
||||
name: string;
|
||||
_uid: number;
|
||||
_store: ModernStore;
|
||||
|
|
@ -13,11 +14,12 @@ class MakiObject {
|
|||
js_annotations: Object;
|
||||
|
||||
constructor(
|
||||
node: ResolvedXmlNode,
|
||||
node: XmlNode,
|
||||
parent: MakiObject,
|
||||
annotations: Object = {},
|
||||
store: ModernStore
|
||||
) {
|
||||
this._node = node;
|
||||
this._store = store;
|
||||
if (node) {
|
||||
this._uid = node.uid;
|
||||
|
|
@ -47,6 +49,10 @@ class MakiObject {
|
|||
this.children = this.children.filter(item => item !== child);
|
||||
}
|
||||
|
||||
js_getChildren(): MakiObject[] {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
js_delete() {
|
||||
this.parent.js_removeChild(this);
|
||||
this.parent.js_trigger("js_update");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue