-
Star
(1,137)
You must be signed in to star a gist -
Fork
(98)
You must be signed in to fork a gist
-
-
Save tomhicks/6cb5e827723c4eaef638bf9f7686d2d8 to your computer and use it in GitHub Desktop.
| /* | |
| Copy this into the console of any web page that is interactive and doesn't | |
| do hard reloads. You will hear your DOM changes as different pitches of | |
| audio. | |
| I have found this interesting for debugging, but also fun to hear web pages | |
| render like UIs do in movies. | |
| */ | |
| const audioCtx = new (window.AudioContext || window.webkitAudioContext)() | |
| const observer = new MutationObserver(function(mutationsList) { | |
| const oscillator = audioCtx.createOscillator() | |
| oscillator.connect(audioCtx.destination) | |
| oscillator.type = "sine" | |
| oscillator.frequency.setValueAtTime( | |
| Math.log(mutationsList.length + 5) * 880, | |
| audioCtx.currentTime, | |
| ) | |
| oscillator.start() | |
| oscillator.stop(audioCtx.currentTime + 0.01) | |
| }) | |
| observer.observe(document, { | |
| attributes: true, | |
| childList: true, | |
| subtree: true, | |
| characterData: true, | |
| }) |
@everaldo I'm working on it at the moment: https://github.com/r4meau/plink-plonk
Also, great idea about the console errors. Added this to the list of features in the README :). For the requests, it's already in the list.
@R4meau, that's awesome!
Maybe someone makes some chrome extension?
And the bookmarklet version:
javascript:(function(){const%20audioCtx=new(window.AudioContext||window.webkitAudioContext);const%20oscillator=audioCtx.createOscillator();oscillator.connect(audioCtx.destination);oscillator.type="sine";let%20numItems=0;oscillator.frequency.setValueAtTime(1,audioCtx.currentTime);oscillator.start();const%20observer=new%20MutationObserver(function(mutationsList){numItems+=mutationsList.length;oscillator.frequency.setValueAtTime(Math.log(numItems+1)*440,audioCtx.currentTime);setTimeout(()=>{numItems-=mutationsList.length;if(numItems===0){oscillator.frequency.setValueAtTime(1,audioCtx.currentTime)}else{oscillator.frequency.setValueAtTime(Math.log(numItems+1)*440,audioCtx.currentTime)}},100)});observer.observe(document,{attributes:true,childList:true,subtree:true,characterData:true})})();
Maybe someone makes some chrome extension?
Yeah, let's do it... (adding to backlog) 😅
@aibolik Already in the making: https://github.com/r4meau/plink-plonk
Feel free to fork and contribute... or start your own. 😄
I'm gonna go slow on it for now (Sunday only), but I'll accept useful PRs at anytime.
Could anyone add reload support? This is so wonderful 🥰 Maybe via localStorage? Or as Firefox Extension?
Its so helpful to find out the DOM manipulations happening behind the eyes!!. Good job @R4meau
Awesome idea!
It would be nice to create some debugging library with sounds for Ajax Requests, Ajax failures, console errors etc.