From 63ed74d6478e9f378ddd41ade9bbcda9db6a7bcb Mon Sep 17 00:00:00 2001 From: x0x7 Date: Sat, 8 Feb 2025 12:50:27 -0500 Subject: [PATCH] Moved named functions out of the async run context --- saveprompt.user.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/saveprompt.user.js b/saveprompt.user.js index 4b95532..920bd7d 100644 --- a/saveprompt.user.js +++ b/saveprompt.user.js @@ -8,12 +8,13 @@ // ==/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(){ - function timeout(ms) { + for await (let newTarget of targetDivs()) { + applyHandler(newTarget); + } +})(); + +function timeout(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } @@ -31,10 +32,6 @@ await timeout(500); } } - for await (let newTarget of targetDivs()) { - applyHandler(newTarget); - } -})(); function shouldSaveDraft(oldVal, newVal) { // Save if text was added or replaced (not pure deletion).