Add playground demo with hot reload.

This commit is contained in:
Henning Dieterichs
2020-02-13 17:14:11 +01:00
parent e32dc47a7e
commit d2e2d94f80

View File

@@ -0,0 +1,37 @@
import {
enableHotReload,
registerUpdateReconciler,
getReloadCount,
hotCallExportedFunction,
} from "@hediet/node-reload";
enableHotReload();
registerUpdateReconciler(module);
import { registerDefaultExtractors } from "@hediet/debug-visualizer-data-extraction";
registerDefaultExtractors();
if (getReloadCount(module) === 0) {
// set interval so that the file watcher can detect changes in other files.
setInterval(() => {
hotCallExportedFunction(module, run);
}, 1000);
}
export function run() {
new Demo().run();
}
class Demo {
private f = new Foo(new Foo(undefined));
private arr = [new Foo(this.f), this.f];
private set = new Set([this.arr[0], new Foo(new Foo(this.arr[1]))]);
run() {
debugger;
}
}
class Foo {
constructor(public readonly next: Foo | undefined) {}
}