Moved named functions out of the async run context

This commit is contained in:
x0x7 2025-02-08 12:50:27 -05:00
parent db155fbe27
commit 63ed74d647
1 changed files with 6 additions and 9 deletions

View File

@ -8,11 +8,12 @@
// ==/UserScript== // ==/UserScript==
//This userscript will save any prompt you write into chatgpt into your local storage
//This means if a tab gets closed and you had a very well thought out prompt that gets lost you can still dig for it
//Prompts are saved by their unix timestamp
(async function(){ (async function(){
for await (let newTarget of targetDivs()) {
applyHandler(newTarget);
}
})();
function timeout(ms) { function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
@ -31,10 +32,6 @@
await timeout(500); await timeout(500);
} }
} }
for await (let newTarget of targetDivs()) {
applyHandler(newTarget);
}
})();
function shouldSaveDraft(oldVal, newVal) { function shouldSaveDraft(oldVal, newVal) {
// Save if text was added or replaced (not pure deletion). // Save if text was added or replaced (not pure deletion).