feat(transfer): persist reusable transfer tasks
This commit is contained in:
1 parent
1a10db4c18
commit
05361eb40d
26 files changed
+2628
-241
No files matched your search
@@ -0,0 +1,21 @@
|
||||
export interface TaskLoadToken {
|
||||
generation: number;
|
||||
taskId: string;
|
||||
}
|
||||
|
||||
export function createTaskLoadTracker() {
|
||||
let generation = 0;
|
||||
|
||||
return {
|
||||
begin(taskId: string): TaskLoadToken {
|
||||
generation += 1;
|
||||
return { generation, taskId };
|
||||
},
|
||||
cancel() {
|
||||
generation += 1;
|
||||
},
|
||||
isCurrent(token: TaskLoadToken, activeTaskId: string | null) {
|
||||
return token.generation === generation && token.taskId === activeTaskId;
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user