What do you want now? (Request extensions here)

Sorry, I just realized that you gave me the answer in your first reply with addEventListener.
I didn’t understand it until I did more research.
willShowNextQuestion - will be triggered when transitioning to the next page.
“Documented” at Updates to Lessons, Reviews, and Extra Study - #28 by tofugu-scott


For now, I’m just copying and pasting in my browser’s console once at the start of the review.
We probably could make it into a script for tamper monkey etc, but I don’t have them installed, nor have I fully tested it yet.

Also, it might not work on the first review, but it isn’t too bad. I can live with it.

// Just get all audio for the next page. Maybe some optimizations can be done in the future.
// We are just doing a fetch and ignoring the output to force the browser to pre-load the audios.

window.addEventListener('willShowNextQuestion', (ev) => {
  // console.log(ev)
  if(ev["detail"]["subject"]["readings"]) {
    for(const reading of ev["detail"]["subject"]["readings"]) {
	  for(const pronunciation of reading["pronunciations"]){
	    for(const source of pronunciation["sources"]) {
		  var audio = source["url"];
		  // console.log("Pre-fetching " + audio);
          fetch(audio, {mode: 'no-cors'});
        }
      }
	}
  }
})