js: add generated child remove api
This commit is contained in:
2
doric-js/lib/src/ui/view.d.ts
vendored
2
doric-js/lib/src/ui/view.d.ts
vendored
@@ -123,4 +123,6 @@ export declare abstract class Group extends Superview {
|
||||
readonly children: View[];
|
||||
allSubviews(): View[];
|
||||
addChild(view: View): void;
|
||||
removeChild(view: View): void;
|
||||
removeAllChildren(): void;
|
||||
}
|
||||
|
@@ -329,4 +329,12 @@ export class Group extends Superview {
|
||||
addChild(view) {
|
||||
this.children.push(view);
|
||||
}
|
||||
removeChild(view) {
|
||||
const ret = this.children.filter(e => e !== view);
|
||||
this.children.length = 0;
|
||||
ret.forEach(e => this.addChild(e));
|
||||
}
|
||||
removeAllChildren() {
|
||||
this.children.length = 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user