Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save barisere/6f738348f3517611d229bacd7a65f18a to your computer and use it in GitHub Desktop.
Save barisere/6f738348f3517611d229bacd7a65f18a to your computer and use it in GitHub Desktop.
const deleteRequests = new WeakMap<Element, number>();
const delayDeleteResource = function (resourceId: string, delay: number) {
const request = new XMLHttpRequest()
request.open('DELETE', `https://yourdomain/resource/${resourceId}`, true);
// other steps for initializing the request, attaching listeners, ...
return setTimeout(request.send.bind(request), delay);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment