Skip to content

Commit

Permalink
Merge pull request #1503 from sveltejs/gh-1502
Browse files Browse the repository at this point in the history
fix bind:online in dev mode
  • Loading branch information
Rich-Harris authored May 28, 2018
2 parents 024530e + cf2be1b commit 2537864
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/compile/nodes/Window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down

0 comments on commit 2537864

Please sign in to comment.