first commit

This commit is contained in:
2026-07-12 15:55:18 +05:30
commit ee98026cc5
404 changed files with 44522 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import { expect, test } from "bun:test";
import { signal } from "../src/index.ts";
test("signal skips equal writes and supports safe unsubscribe during notification", () => {
const count = signal(0);
const seen: number[] = [];
let off = () => {};
off = count.subscribe((value) => {
seen.push(value);
off();
});
count.set(0);
count.update((value) => value + 1);
count.set(2);
expect(seen).toEqual([1]);
expect(count.get()).toBe(2);
});