Merge pull request #1503 from sveltejs/gh-1502

fix bind:online in dev mode
pull/1516/head
Rich Harris 7 years ago committed by GitHub
commit 2537864293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -200,7 +200,9 @@ export default class Window extends Node {
const handlerName = block.getUniqueName(`onlinestatuschanged`);
block.builders.init.addBlock(deindent`
function ${handlerName}(event) {
${compiler.options.dev && `component._updatingReadonlyProperty = true;`}
#component.set({ ${bindings.online}: navigator.onLine });
${compiler.options.dev && `component._updatingReadonlyProperty = false;`}
}
window.addEventListener("online", ${handlerName});
window.addEventListener("offline", ${handlerName});

Loading…
Cancel
Save