diff --git a/core/src/plugins/donkey.js b/core/src/plugins/donkey.js index f64fecf4121..2f7fbb08467 100644 --- a/core/src/plugins/donkey.js +++ b/core/src/plugins/donkey.js @@ -5,7 +5,13 @@ const { stringify } = JSON; const invoke = (name, args) => `${name}(code, ${args.join(", ")})`; -const donkey = ({ type = "py", persistent, terminal, config }) => { +const donkey = ({ + type = "py", + persistent, + terminal, + config, + serviceWorker, +}) => { const globals = terminal ? '{"__terminal__":__terminal__}' : "{}"; const args = persistent ? ["globals()", "__locals__"] : [globals, "{}"]; @@ -46,6 +52,7 @@ const donkey = ({ type = "py", persistent, terminal, config }) => { typeof config === "string" ? config : stringify(config), ); } + if (serviceWorker) script.setAttribute("service-worker", serviceWorker); return addPromiseListener( document.body.appendChild(script),