Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
paste this in the browser console then drag an audio file to the page to replace the notification sound
(async function(){
async function writeSound(cache, url){
const el = document.createElement("div");
document.body.appendChild(el); = "white"; = = "100%"; = "absolute"; = 1000;
el.textContent = "drag an audio file to this page";
el.addEventListener("dragover", e => e.preventDefault());
const file = await new Promise(resolve => {
el.addEventListener("drop", e => {
const response = new Response(file);
cache.put(url, response);
el.textContent = "refresh the page to apply the changes";
const cacheKeys = await caches.keys();
for(const cacheKey of cacheKeys){
const cache = await;
const keys = await cache.keys();
for(const request of keys){
await writeSound(cache, request.url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment