Delete javascript_notes.txt

This commit is contained in:
scott 2024-05-09 22:23:49 +00:00
parent 4f734ddf74
commit 113e7f369f

View File

@ -1,45 +0,0 @@
keywords to research:
1. async
2. await
3. fetch
4. Promise.all
5. resolve()
6. Blob() - needed to download files. Creation of a blob is needed to link the data to a download link to trigger a download see
the sample javascript below.
7. new - I think this is a constructor?
8. appendChild
9. createElement
10. removeChild
11. window.URL.createObjectURL
12. click
13. window
// Create a Blob containing the file data
var fileData = "Hello, this is the content of the file!";
var blob = new Blob([fileData], { type: "text/plain" });
// Create an anchor element and set its attributes
var a = document.createElement("a");
a.href = window.URL.createObjectURL(blob); // Create a URL for the Blob
a.download = "example.txt";
// Append the anchor element to the body
document.body.appendChild(a);
// Programmatically click the anchor to trigger the download
a.click();
// Remove the anchor from the body
document.body.removeChild(a);
* may have to concatenate the games with newlines prior to making the blob. DEFINITELY HAVE TO
Keep in mind that if the number of games is large, and you're dealing with a substantial amount of data, you might want to consider optimizing the concatenation process to avoid performance issues. Depending on your use case, you could use an array to store the individual games and then use the join method to concatenate them with a separator.
-- you will have to piece the app together
UPDATE: since your site is static and your client essentially has to download the entire website to their machine first it means that requests are not coming from a different origin. This means you don't need jsonp or cors. So you can write your application without the necessary complications