Files
scriptc/tests/corpus/global-string-cache/main.js
Chris Tate c257368c5e Compile Effect generators statically (#589)
* Compile Effect generators statically

* test: declare the dormant array write's expected fence
2026-09-30 14:25:29 -05:00

13 lines
437 B
JavaScript

import { read } from "./remote.js";
const key = "scriptc.test.string-cache";
let count = 0;
function compute() { count++; return new Map(); }
globalThis[key] ??= compute();
globalThis[key] ??= compute();
const cache = globalThis[key];
cache.set("message", "hello");
console.log(count, read() === cache, read().get("message"));
const host = globalThis;
host["scriptc.test.string-cache"] = "changed";
console.log(globalThis[key], read());