Created
July 29, 2023 06:58
-
-
Save stevedep/2f431d27fcfbe40c7816fac261df3253 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getTransactions(i) { | |
let response = await // fetch here | |
let data = await response.json(); | |
return data; | |
} | |
function process(r, i, a) { | |
console.log(i) | |
result.push(r[0].data.recipeSearch.result) | |
if (i == a){ //* 1 + 7))) { | |
console.log("download") | |
//download("ah.json", result); | |
} | |
} | |
function download(filename, text) { | |
var pom = document.createElement('a'); | |
pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(text))); | |
pom.setAttribute('download', filename); | |
if (document.createEvent) { | |
var event = document.createEvent('MouseEvents'); | |
event.initEvent('click', true, true); | |
pom.dispatchEvent(event); | |
} | |
else { | |
pom.click(); | |
} | |
} | |
result = [] | |
a = 2//217 | |
for (let index = 0; index <= a; index++) { | |
await getTransactions(index).then(data => process(data, index, a)); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment