feat: add snapshot feature for devkit, this is for android
This commit is contained in:
5
doric-js/lib/src/ui/panel.d.ts
vendored
5
doric-js/lib/src/ui/panel.d.ts
vendored
@@ -31,6 +31,11 @@ export declare abstract class Panel {
|
||||
private __onEnvChanged__;
|
||||
private __response__;
|
||||
private retrospectView;
|
||||
private snapshotEnabled;
|
||||
private renderSnapshots;
|
||||
private __renderSnapshotDepth__;
|
||||
private __restoreRenderSnapshot__;
|
||||
private __enableSnapshot__;
|
||||
private nativeRender;
|
||||
private hookBeforeNativeCall;
|
||||
private hookAfterNativeCall;
|
||||
|
@@ -40,6 +40,8 @@ export class Panel {
|
||||
this.headviews = new Map;
|
||||
this.onRenderFinishedCallback = [];
|
||||
this.__rendering__ = false;
|
||||
this.snapshotEnabled = false;
|
||||
this.renderSnapshots = [];
|
||||
}
|
||||
onCreate() { }
|
||||
onDestroy() { }
|
||||
@@ -148,7 +150,19 @@ export 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() {
|
||||
@@ -280,3 +294,21 @@ __decorate([
|
||||
__metadata("design:paramtypes", [Array, String]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], Panel.prototype, "__response__", null);
|
||||
__decorate([
|
||||
NativeCall,
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], Panel.prototype, "__renderSnapshotDepth__", null);
|
||||
__decorate([
|
||||
NativeCall,
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Number]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], Panel.prototype, "__restoreRenderSnapshot__", null);
|
||||
__decorate([
|
||||
NativeCall,
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], Panel.prototype, "__enableSnapshot__", null);
|
||||
|
Reference in New Issue
Block a user