mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-10-23 10:13:13 +02:00
29 lines
545 B
TypeScript
29 lines
545 B
TypeScript
export type Position = {
|
|
row: number;
|
|
column: number;
|
|
};
|
|
|
|
export class PositionTracker {
|
|
positions: Map<string, Position>;
|
|
|
|
constructor() {
|
|
this.positions = new Map<string, Position>();
|
|
}
|
|
|
|
saveCursor(filename: string, pos: Position): void {
|
|
this.positions.set(filename, pos);
|
|
}
|
|
|
|
getCursor(filename: string): Position {
|
|
const position = this.positions.get(filename);
|
|
if (!position) {
|
|
return {
|
|
row: -1,
|
|
column: -1,
|
|
};
|
|
}
|
|
return position;
|
|
}
|
|
}
|
|
|
|
export const CursorPositions: PositionTracker = new PositionTracker(); |