From 795f40c8bfb9d2328ee4cbc40d012313d9ab5075 Mon Sep 17 00:00:00 2001 From: Reinder Nijhoff Date: Wed, 20 Mar 2024 10:35:57 +0100 Subject: [PATCH] Update dittytoyJukebox.js --- example/src/dittytoyJukebox.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/example/src/dittytoyJukebox.js b/example/src/dittytoyJukebox.js index 1a391e3..927cb21 100644 --- a/example/src/dittytoyJukebox.js +++ b/example/src/dittytoyJukebox.js @@ -14,8 +14,7 @@ export default class DittytoyJukebox { this.fetchDitties(); - const urlParams = new URLSearchParams(window.location.search); - const dittyId = urlParams.get('ditty') || '24373308b4'; + const dittyId = window.location.hash?.slice(1) || '24373308b4'; this.fetchDitty(dittyId); $('play-button').addEventListener('click', async () => { @@ -68,6 +67,8 @@ export default class DittytoyJukebox { }); await this.dittytoy.compile(this.ditty.code); + + window.location.hash = `${id}`; } async pause() {