设计tracer
This commit is contained in:
@@ -21,6 +21,6 @@ export class Commander {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public output() {
|
public output() {
|
||||||
return this.commands;
|
return JSON.stringify(this.commands);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class ArrayTracer<T> {
|
|||||||
commander.command({
|
commander.command({
|
||||||
action: "define",
|
action: "define",
|
||||||
tracer: null,
|
tracer: null,
|
||||||
params: {
|
payload: {
|
||||||
type: "ArrayTracer",
|
type: "ArrayTracer",
|
||||||
id: arrayTracer.tracerId,
|
id: arrayTracer.tracerId,
|
||||||
desc: option.description,
|
desc: option.description,
|
||||||
@@ -34,7 +34,7 @@ export class ArrayTracer<T> {
|
|||||||
commander.command({
|
commander.command({
|
||||||
action: "preset",
|
action: "preset",
|
||||||
tracer: this.tracerId,
|
tracer: this.tracerId,
|
||||||
params: array,
|
payload: array,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ export class ArrayTracer<T> {
|
|||||||
commander.command({
|
commander.command({
|
||||||
action: "extend",
|
action: "extend",
|
||||||
tracer: this.tracerId,
|
tracer: this.tracerId,
|
||||||
params: { size },
|
payload: { size },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ export class ArrayTracer<T> {
|
|||||||
commander.command({
|
commander.command({
|
||||||
action: "shrink",
|
action: "shrink",
|
||||||
tracer: this.tracerId,
|
tracer: this.tracerId,
|
||||||
params: { size },
|
payload: { size },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ export class ArrayTracer<T> {
|
|||||||
commander.command({
|
commander.command({
|
||||||
action: "pick",
|
action: "pick",
|
||||||
tracer: this.tracerId,
|
tracer: this.tracerId,
|
||||||
params: { index },
|
payload: { index },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ export class ArrayTracer<T> {
|
|||||||
commander.command({
|
commander.command({
|
||||||
action: "drop",
|
action: "drop",
|
||||||
tracer: this.tracerId,
|
tracer: this.tracerId,
|
||||||
params: { index },
|
payload: { index },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ export class ArrayTracer<T> {
|
|||||||
commander.command({
|
commander.command({
|
||||||
action: "patch",
|
action: "patch",
|
||||||
tracer: this.tracerId,
|
tracer: this.tracerId,
|
||||||
params: { index, value },
|
payload: { index, value },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ export class ArrayTracer<T> {
|
|||||||
commander.command({
|
commander.command({
|
||||||
action: "reset",
|
action: "reset",
|
||||||
tracer: this.tracerId,
|
tracer: this.tracerId,
|
||||||
params: { index },
|
payload: { index },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +1,49 @@
|
|||||||
export type ArrayTracerDefineCommand = {
|
export type ArrayTracerDefineCommand = {
|
||||||
action: "define";
|
action: "define";
|
||||||
tracer: null;
|
tracer: null;
|
||||||
params: { type: "ArrayTracer"; id: string; desc?: string };
|
payload: { type: "ArrayTracer"; id: string; desc?: string };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ArrayTracerPresetCommand<T = unknown> = {
|
export type ArrayTracerPresetCommand<T = unknown> = {
|
||||||
action: "preset";
|
action: "preset";
|
||||||
tracer: string;
|
tracer: string;
|
||||||
params: T[];
|
payload: T[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ArrayTracerExtendCommand = {
|
export type ArrayTracerExtendCommand = {
|
||||||
action: "extend";
|
action: "extend";
|
||||||
tracer: string;
|
tracer: string;
|
||||||
params: { size: number };
|
payload: { size: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ArrayTracerShrinkCommand = {
|
export type ArrayTracerShrinkCommand = {
|
||||||
action: "shrink";
|
action: "shrink";
|
||||||
tracer: string;
|
tracer: string;
|
||||||
params: { size: number };
|
payload: { size: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ArrayTracerPickCommand = {
|
export type ArrayTracerPickCommand = {
|
||||||
action: "pick";
|
action: "pick";
|
||||||
tracer: string;
|
tracer: string;
|
||||||
params: { index: number };
|
payload: { index: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ArrayTracerDropCommand = {
|
export type ArrayTracerDropCommand = {
|
||||||
action: "drop";
|
action: "drop";
|
||||||
tracer: string;
|
tracer: string;
|
||||||
params: { index: number };
|
payload: { index: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ArrayTracerPatchCommand<T = unknown> = {
|
export type ArrayTracerPatchCommand<T = unknown> = {
|
||||||
action: "patch";
|
action: "patch";
|
||||||
tracer: string;
|
tracer: string;
|
||||||
params: { index: number; value: T };
|
payload: { index: number; value: T };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ArrayTracerResetCommand = {
|
export type ArrayTracerResetCommand = {
|
||||||
action: "reset";
|
action: "reset";
|
||||||
tracer: string;
|
tracer: string;
|
||||||
params: { index: number };
|
payload: { index: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ArrayTracerCommand<T = never> =
|
export type ArrayTracerCommand<T = never> =
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { ArrayTracerDefineCommand } from "../command";
|
import type { ArrayTracerDefineCommand } from "../command";
|
||||||
|
|
||||||
type ArrayTracer = ArrayTracerDefineCommand["params"]["type"];
|
type ArrayTracer = ArrayTracerDefineCommand["payload"]["type"];
|
||||||
|
|
||||||
export type TracerType = ArrayTracer;
|
export type TracerType = ArrayTracer;
|
||||||
|
|||||||
Reference in New Issue
Block a user