module

Plombir::LiveReload

Constants

EVENTS_PATH = "/__plombir__/events"

Reserved event-stream path in dev. Checked before static files, so a site page at this route is shadowed (acceptable).

HEARTBEAT = 15.seconds

Heartbeat: dead tabs are reaped on write failure, at most this late after disconnecting.

SNIPPET = "<script>(function(){var s=new EventSource(\"#{EVENTS_PATH}\");s.onmessage=function(){location.reload();};})();</script>"

Inline snippet served pages carry in dev. EventSource reconnects by itself across server restarts.

Class methods

inject(html : String) : String

Injects SNIPPET before </body>, appending when absent.

Source

Nested types