Kode / khamake

Kha's build tool.
http://kha.tech
15 stars 45 forks source link

--livereload #260

Closed RblSb closed 2 years ago

RblSb commented 2 years ago

If you think that this is too fat, i will move this to personal plugin, i guess. On client side it looks like this:

#if kha_live_reload
function openWebSocket():Void {
    var host = Browser.location.hostname;
    if (host == "") host = "localhost";
    final port = "" + (Std.parseInt(Browser.location.port) + 1);
    final colonPort = port.length > 0 ? ':$port' : port;
    final path = Browser.location.pathname;
    final ws = new WebSocket('ws://$host$colonPort$path');
    ws.onmessage = () -> Browser.location.reload();
}
openWebSocket();
#end
RobDangerous commented 2 years ago

Looks nicely simple. The removal of types/chokidar was just a mistake I assume, right?

RblSb commented 2 years ago

Nope, that types/chokidar is not needed since chokidar 3 (ts types are out of box)

RobDangerous commented 2 years ago

Ah, all right, thanks.