feat:should receive multi onRenderFinishedCallbacks

This commit is contained in:
pengfei.zhou
2020-03-10 19:18:33 +08:00
committed by osborn
parent f3f28c55f8
commit 1f5fd7de30
12 changed files with 104 additions and 40 deletions

View File

@@ -898,6 +898,7 @@ var Panel = /** @class */ (function () {
function Panel() {
this.__root__ = new Root;
this.headviews = new Map;
this.onRenderFinishedCallback = [];
}
Panel.prototype.onCreate = function () { };
Panel.prototype.onDestroy = function () { };
@@ -1127,11 +1128,18 @@ var Panel = /** @class */ (function () {
});
}
Promise.all(promises).then(function (_) {
if (_this.onRenderFinished) {
_this.onRenderFinished();
}
_this.onRenderFinished();
});
};
Panel.prototype.onRenderFinished = function () {
this.onRenderFinishedCallback.forEach(function (e) {
e();
});
this.onRenderFinishedCallback.length = 0;
};
Panel.prototype.addOnRenderFinishedCallback = function (cb) {
this.onRenderFinishedCallback.push(cb);
};
__decorate$2([
NativeCall,
__metadata$2("design:type", Function),
@@ -2917,7 +2925,7 @@ function coordinator(context) {
verticalScrolling: function (argument) {
if (context.entity instanceof Panel) {
var panel = context.entity;
panel.onRenderFinished = function () {
panel.addOnRenderFinishedCallback(function () {
argument.scrollable = viewIdChains(argument.scrollable);
if (argument.target instanceof View) {
argument.target = viewIdChains(argument.target);
@@ -2928,8 +2936,8 @@ 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);
});
}
}
};

View File

@@ -669,6 +669,7 @@ class Panel {
constructor() {
this.__root__ = new Root;
this.headviews = new Map;
this.onRenderFinishedCallback = [];
}
onCreate() { }
onDestroy() { }
@@ -820,11 +821,18 @@ 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$2([
NativeCall,
@@ -2209,7 +2217,7 @@ 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);
@@ -2220,8 +2228,8 @@ 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);
});
}
}
};

View File

@@ -2128,6 +2128,7 @@ class Panel {
constructor() {
this.__root__ = new Root;
this.headviews = new Map;
this.onRenderFinishedCallback = [];
}
onCreate() { }
onDestroy() { }
@@ -2279,11 +2280,18 @@ 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$2([
NativeCall,
@@ -3668,7 +3676,7 @@ 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);
@@ -3679,8 +3687,8 @@ 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);
});
}
}
};