feat: add snapshot feature for devkit, this is for android

This commit is contained in:
pengfei.zhou
2021-07-09 17:16:30 +08:00
committed by osborn
parent 35b9d67de6
commit dbe94165b9
19 changed files with 500 additions and 7 deletions

View File

@@ -2400,6 +2400,8 @@ class Panel {
this.headviews = new Map;
this.onRenderFinishedCallback = [];
this.__rendering__ = false;
this.snapshotEnabled = false;
this.renderSnapshots = [];
}
onCreate() { }
onDestroy() { }
@@ -2508,7 +2510,19 @@ class Panel {
}
}, undefined);
}
__renderSnapshotDepth__() {
return this.renderSnapshots.length;
}
__restoreRenderSnapshot__(idx) {
return [...this.renderSnapshots].slice(0, idx);
}
__enableSnapshot__() {
this.snapshotEnabled = true;
}
nativeRender(model) {
if (this.snapshotEnabled) {
this.renderSnapshots.push(JSON.parse(JSON.stringify(model)));
}
return this.context.callNative("shader", "render", model);
}
hookBeforeNativeCall() {
@@ -2640,6 +2654,24 @@ __decorate$b([
__metadata$b("design:paramtypes", [Array, String]),
__metadata$b("design:returntype", void 0)
], Panel.prototype, "__response__", null);
__decorate$b([
NativeCall,
__metadata$b("design:type", Function),
__metadata$b("design:paramtypes", []),
__metadata$b("design:returntype", void 0)
], Panel.prototype, "__renderSnapshotDepth__", null);
__decorate$b([
NativeCall,
__metadata$b("design:type", Function),
__metadata$b("design:paramtypes", [Number]),
__metadata$b("design:returntype", void 0)
], Panel.prototype, "__restoreRenderSnapshot__", null);
__decorate$b([
NativeCall,
__metadata$b("design:type", Function),
__metadata$b("design:paramtypes", []),
__metadata$b("design:returntype", void 0)
], Panel.prototype, "__enableSnapshot__", null);
/*
* Copyright [2019] [Doric.Pub]

File diff suppressed because one or more lines are too long