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
"use server"; | |
export async function submitAction( | |
previousState: { count: FormDataEntryValue | null }, | |
formData: FormData, | |
) { | |
// delay | |
await new Promise((res) => setTimeout(res, 1000)); | |
const name = formData.get("name"); |
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
/** | |
* Fast hashing algorithm for generating etags | |
* http://www.cse.yorku.ca/~oz/hash.html | |
* | |
* taken from sveltekit | |
* https://github.com/sveltejs/kit/blob/25d459104814b0c2dc6b4cf73b680378a29d8200/packages/kit/src/runtime/hash.js | |
*/ | |
const djb2 = (...values: (string | ArrayBufferView)[]) => { | |
let hash = 5381; |