Moved named functions out of the async run context
This commit is contained in:
parent
db155fbe27
commit
63ed74d647
|
@ -8,12 +8,13 @@
|
||||||
// ==/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(){
|
||||||
function timeout(ms) {
|
for await (let newTarget of targetDivs()) {
|
||||||
|
applyHandler(newTarget);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
Loading…
Reference in New Issue