mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-23 10:07:35 +00:00
Make parent optional
This commit is contained in:
parent
a8df0dd575
commit
8ed22cf414
2 changed files with 8 additions and 2 deletions
|
|
@ -10,14 +10,14 @@ class MakiObject {
|
|||
// type conversion differently. Having one type that holds both the pre and
|
||||
// post type coerced values is too confusing.
|
||||
attributes: { [key: string]: string | number | boolean | undefined };
|
||||
parent: MakiObject;
|
||||
parent: MakiObject | null;
|
||||
_emitter: Emitter;
|
||||
children: MakiObject[];
|
||||
js_annotations: Object;
|
||||
|
||||
constructor(
|
||||
node: XmlNode | null,
|
||||
parent: MakiObject,
|
||||
parent: MakiObject | null,
|
||||
annotations: Object = {}
|
||||
) {
|
||||
if (node) {
|
||||
|
|
@ -61,6 +61,9 @@ class MakiObject {
|
|||
}
|
||||
|
||||
js_delete() {
|
||||
if (this.parent == null) {
|
||||
return;
|
||||
}
|
||||
this.parent.js_removeChild(this);
|
||||
this.parent.js_trigger("js_update");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,12 @@ type Command =
|
|||
class PopupMenu extends MakiObject {
|
||||
_commands: Command[];
|
||||
_guiParent: Group;
|
||||
parent: MakiObject;
|
||||
js_selectCommand: (id: number) => void;
|
||||
|
||||
constructor(node: XmlNode, parent: MakiObject, annotations: Object) {
|
||||
super(node, parent, annotations);
|
||||
this.parent = parent;
|
||||
|
||||
if (!(parent instanceof Group)) {
|
||||
throw new Error(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue