Add API for synchronous rendering to Panel
This commit is contained in:
1
doric-js/lib/src/ui/panel.d.ts
vendored
1
doric-js/lib/src/ui/panel.d.ts
vendored
@@ -44,6 +44,7 @@ export declare abstract class Panel {
|
||||
private nativeRender;
|
||||
private hookBeforeNativeCall;
|
||||
private hookAfterNativeCall;
|
||||
private __fetchEffectiveData__;
|
||||
onRenderFinished(): void;
|
||||
addOnRenderFinishedCallback(cb: () => void): void;
|
||||
}
|
||||
|
@@ -199,6 +199,27 @@ export class Panel {
|
||||
});
|
||||
}
|
||||
}
|
||||
__fetchEffectiveData__() {
|
||||
const diryData = [];
|
||||
if (this.destroyed) {
|
||||
return diryData;
|
||||
}
|
||||
if (this.__root__.isDirty()) {
|
||||
const model = this.__root__.toModel();
|
||||
diryData.push(JSON.parse(JSON.stringify(model)));
|
||||
this.__root__.clean();
|
||||
}
|
||||
for (let map of this.headviews.values()) {
|
||||
for (let v of map.values()) {
|
||||
if (v.isDirty()) {
|
||||
const model = v.toModel();
|
||||
diryData.push(JSON.parse(JSON.stringify(model)));
|
||||
v.clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
return diryData;
|
||||
}
|
||||
onRenderFinished() {
|
||||
this.onRenderFinishedCallback.forEach(e => {
|
||||
e();
|
||||
|
Reference in New Issue
Block a user