feat:fix when call build and onShow at once,then onRenderFinishedCallback maybe called before the render action finished
This commit is contained in:
parent
cabb1b1f82
commit
c34fe50104
@ -949,6 +949,7 @@ var Panel = /** @class */ (function () {
|
|||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
this.onRenderFinishedCallback = [];
|
this.onRenderFinishedCallback = [];
|
||||||
|
this.__rendering__ = false;
|
||||||
}
|
}
|
||||||
Panel.prototype.onCreate = function () { };
|
Panel.prototype.onCreate = function () { };
|
||||||
Panel.prototype.onDestroy = function () { };
|
Panel.prototype.onDestroy = function () { };
|
||||||
@ -1176,9 +1177,18 @@ var Panel = /** @class */ (function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(function (_) {
|
if (this.__rendering__) {
|
||||||
_this.onRenderFinished();
|
//skip
|
||||||
});
|
Promise.all(promises).then(function (_) {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.__rendering__ = true;
|
||||||
|
Promise.all(promises).then(function (_) {
|
||||||
|
_this.__rendering__ = false;
|
||||||
|
_this.onRenderFinished();
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Panel.prototype.onRenderFinished = function () {
|
Panel.prototype.onRenderFinished = function () {
|
||||||
this.onRenderFinishedCallback.forEach(function (e) {
|
this.onRenderFinishedCallback.forEach(function (e) {
|
||||||
|
@ -704,6 +704,7 @@ class Panel {
|
|||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
this.onRenderFinishedCallback = [];
|
this.onRenderFinishedCallback = [];
|
||||||
|
this.__rendering__ = false;
|
||||||
}
|
}
|
||||||
onCreate() { }
|
onCreate() { }
|
||||||
onDestroy() { }
|
onDestroy() { }
|
||||||
@ -853,9 +854,18 @@ class Panel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
if (this.__rendering__) {
|
||||||
this.onRenderFinished();
|
//skip
|
||||||
});
|
Promise.all(promises).then(_ => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.__rendering__ = true;
|
||||||
|
Promise.all(promises).then(_ => {
|
||||||
|
this.__rendering__ = false;
|
||||||
|
this.onRenderFinished();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onRenderFinished() {
|
onRenderFinished() {
|
||||||
this.onRenderFinishedCallback.forEach(e => {
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
@ -2163,6 +2163,7 @@ class Panel {
|
|||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
this.onRenderFinishedCallback = [];
|
this.onRenderFinishedCallback = [];
|
||||||
|
this.__rendering__ = false;
|
||||||
}
|
}
|
||||||
onCreate() { }
|
onCreate() { }
|
||||||
onDestroy() { }
|
onDestroy() { }
|
||||||
@ -2312,9 +2313,18 @@ class Panel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
if (this.__rendering__) {
|
||||||
this.onRenderFinished();
|
//skip
|
||||||
});
|
Promise.all(promises).then(_ => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.__rendering__ = true;
|
||||||
|
Promise.all(promises).then(_ => {
|
||||||
|
this.__rendering__ = false;
|
||||||
|
this.onRenderFinished();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onRenderFinished() {
|
onRenderFinished() {
|
||||||
this.onRenderFinishedCallback.forEach(e => {
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
1
doric-js/lib/src/ui/panel.d.ts
vendored
1
doric-js/lib/src/ui/panel.d.ts
vendored
@ -13,6 +13,7 @@ export declare abstract class Panel {
|
|||||||
private __root__;
|
private __root__;
|
||||||
private headviews;
|
private headviews;
|
||||||
private onRenderFinishedCallback;
|
private onRenderFinishedCallback;
|
||||||
|
private __rendering__;
|
||||||
addHeadView(type: string, v: View): void;
|
addHeadView(type: string, v: View): void;
|
||||||
allHeadViews(): IterableIterator<Map<string, View>>;
|
allHeadViews(): IterableIterator<Map<string, View>>;
|
||||||
removeHeadView(type: string, v: View | string): void;
|
removeHeadView(type: string, v: View | string): void;
|
||||||
|
@ -38,6 +38,7 @@ export class Panel {
|
|||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
this.onRenderFinishedCallback = [];
|
this.onRenderFinishedCallback = [];
|
||||||
|
this.__rendering__ = false;
|
||||||
}
|
}
|
||||||
onCreate() { }
|
onCreate() { }
|
||||||
onDestroy() { }
|
onDestroy() { }
|
||||||
@ -187,9 +188,18 @@ export class Panel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
if (this.__rendering__) {
|
||||||
this.onRenderFinished();
|
//skip
|
||||||
});
|
Promise.all(promises).then(_ => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.__rendering__ = true;
|
||||||
|
Promise.all(promises).then(_ => {
|
||||||
|
this.__rendering__ = false;
|
||||||
|
this.onRenderFinished();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onRenderFinished() {
|
onRenderFinished() {
|
||||||
this.onRenderFinishedCallback.forEach(e => {
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
@ -47,6 +47,8 @@ export abstract class Panel {
|
|||||||
|
|
||||||
private onRenderFinishedCallback: Array<() => void> = []
|
private onRenderFinishedCallback: Array<() => void> = []
|
||||||
|
|
||||||
|
private __rendering__ = false
|
||||||
|
|
||||||
addHeadView(type: string, v: View) {
|
addHeadView(type: string, v: View) {
|
||||||
let map = this.headviews.get(type)
|
let map = this.headviews.get(type)
|
||||||
if (map) {
|
if (map) {
|
||||||
@ -207,9 +209,17 @@ export abstract class Panel {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
if (this.__rendering__) {
|
||||||
this.onRenderFinished()
|
//skip
|
||||||
})
|
Promise.all(promises).then(_ => {
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.__rendering__ = true
|
||||||
|
Promise.all(promises).then(_ => {
|
||||||
|
this.__rendering__ = false
|
||||||
|
this.onRenderFinished()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private onRenderFinished() {
|
private onRenderFinished() {
|
||||||
this.onRenderFinishedCallback.forEach(e => {
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
16
doric-web/dist/index.js
vendored
16
doric-web/dist/index.js
vendored
@ -2221,6 +2221,7 @@ class Panel {
|
|||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
this.onRenderFinishedCallback = [];
|
this.onRenderFinishedCallback = [];
|
||||||
|
this.__rendering__ = false;
|
||||||
}
|
}
|
||||||
onCreate() { }
|
onCreate() { }
|
||||||
onDestroy() { }
|
onDestroy() { }
|
||||||
@ -2370,9 +2371,18 @@ class Panel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
if (this.__rendering__) {
|
||||||
this.onRenderFinished();
|
//skip
|
||||||
});
|
Promise.all(promises).then(_ => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.__rendering__ = true;
|
||||||
|
Promise.all(promises).then(_ => {
|
||||||
|
this.__rendering__ = false;
|
||||||
|
this.onRenderFinished();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onRenderFinished() {
|
onRenderFinished() {
|
||||||
this.onRenderFinishedCallback.forEach(e => {
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user