mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 23:25:24 +00:00
This commit is contained in:
1 parent
87cc80b291
commit
25816084aa
28 files changed
+1797
-49
No files matched your search
@@ -1,14 +1,8 @@
|
||||
import type { NextFunction, Request, Response } from "express";
|
||||
import { markChanged } from "./feed.js";
|
||||
import { notifyLocalWrite } from "./write-listeners.js";
|
||||
|
||||
const READS = new Set(["GET", "HEAD", "OPTIONS"]);
|
||||
const writeListeners = new Set<() => void>();
|
||||
|
||||
/** Called after every successful write request, for a linked desktop's engine. */
|
||||
export function onLocalWrite(listener: () => void): () => void {
|
||||
writeListeners.add(listener);
|
||||
return () => writeListeners.delete(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Any successful write may change what a linked desktop should have, so it
|
||||
@@ -23,7 +17,7 @@ export function syncChangeWatcher(
|
||||
res.on("finish", () => {
|
||||
if (res.statusCode >= 400) return;
|
||||
markChanged();
|
||||
for (const listener of writeListeners) listener();
|
||||
notifyLocalWrite();
|
||||
});
|
||||
}
|
||||
next();
|
||||
|
||||
Reference in new issue
Block a user