MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / liveReloadClientScript

Function liveReloadClientScript

src/artifacts/live-reload.ts:26–35  ·  view source on GitHub ↗
(channelPath: string = LIVE_CHANNEL_PATH)

Source from the content-addressed store, hash-verified

24 * instead of throwing.
25 */
26export function liveReloadClientScript(channelPath: string = LIVE_CHANNEL_PATH): string {
27 const ch = JSON.stringify(channelPath);
28 return (
29 `<script>(function(){try{` +
30 `var es=new EventSource(${ch});` +
31 `es.addEventListener('reload',function(){location.reload();});` +
32 `es.onerror=function(){/* EventSource auto-reconnects via the server's retry hint */};` +
33 `}catch(e){/* no EventSource → static page, no live reload */}})();</script>`
34 );
35}
36
37/**
38 * Inject the live-reload client into a built preview page. Insert just before `</body>`

Callers 3

injectLiveReloadFunction · 0.85
renderErrorOverlayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected