sepehr 8d95f34fcc fix: Add debounced Undo/Redo system to avoid character-by-character history
- Add debounced state updates for title and content (500ms delay)
- Immediate UI updates with delayed history saving
- Prevent one-letter-per-undo issue
- Add cleanup for debounce timers on unmount
2026-01-04 14:28:11 +01:00

21 lines
490 B
JavaScript

// src/adapter/service-worker/handler.ts
var handle = (app, opts = {
// To use `fetch` on a Service Worker correctly, bind it to `globalThis`.
fetch: globalThis.fetch.bind(globalThis)
}) => {
return (evt) => {
evt.respondWith(
(async () => {
const res = await app.fetch(evt.request, {}, evt);
if (opts.fetch && res.status === 404) {
return await opts.fetch(evt.request);
}
return res;
})()
);
};
};
export {
handle
};