feat:should receive multi onRenderFinishedCallbacks
This commit is contained in:
@@ -15,7 +15,7 @@ export function coordinator(context) {
|
||||
verticalScrolling: (argument) => {
|
||||
if (context.entity instanceof Panel) {
|
||||
const panel = context.entity;
|
||||
panel.onRenderFinished = () => {
|
||||
panel.addOnRenderFinishedCallback(() => {
|
||||
argument.scrollable = viewIdChains(argument.scrollable);
|
||||
if (argument.target instanceof View) {
|
||||
argument.target = viewIdChains(argument.target);
|
||||
@@ -26,8 +26,8 @@ export function coordinator(context) {
|
||||
if (argument.changing.end instanceof Color) {
|
||||
argument.changing.end = argument.changing.end.toModel();
|
||||
}
|
||||
return context.callNative("coordinator", "verticalScrolling", argument);
|
||||
};
|
||||
context.callNative("coordinator", "verticalScrolling", argument);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
4
doric-js/lib/src/ui/panel.d.ts
vendored
4
doric-js/lib/src/ui/panel.d.ts
vendored
@@ -12,7 +12,7 @@ export declare abstract class Panel {
|
||||
private __data__?;
|
||||
private __root__;
|
||||
private headviews;
|
||||
onRenderFinished?: () => void;
|
||||
private onRenderFinishedCallback;
|
||||
addHeadView(type: string, v: View): void;
|
||||
allHeadViews(): IterableIterator<Map<string, View>>;
|
||||
removeHeadView(type: string, v: View | string): void;
|
||||
@@ -30,4 +30,6 @@ export declare abstract class Panel {
|
||||
private nativeRender;
|
||||
private hookBeforeNativeCall;
|
||||
private hookAfterNativeCall;
|
||||
onRenderFinished(): void;
|
||||
addOnRenderFinishedCallback(cb: () => void): void;
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ export class Panel {
|
||||
constructor() {
|
||||
this.__root__ = new Root;
|
||||
this.headviews = new Map;
|
||||
this.onRenderFinishedCallback = [];
|
||||
}
|
||||
onCreate() { }
|
||||
onDestroy() { }
|
||||
@@ -188,11 +189,18 @@ export class Panel {
|
||||
});
|
||||
}
|
||||
Promise.all(promises).then(_ => {
|
||||
if (this.onRenderFinished) {
|
||||
this.onRenderFinished();
|
||||
}
|
||||
this.onRenderFinished();
|
||||
});
|
||||
}
|
||||
onRenderFinished() {
|
||||
this.onRenderFinishedCallback.forEach(e => {
|
||||
e();
|
||||
});
|
||||
this.onRenderFinishedCallback.length = 0;
|
||||
}
|
||||
addOnRenderFinishedCallback(cb) {
|
||||
this.onRenderFinishedCallback.push(cb);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
NativeCall,
|
||||
|
Reference in New Issue
Block a user