Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- run: pnpm install --frozen-lockfile --strict-peer-dependencies
- run: pnpm tsc
- run: pnpm build
- run: pnpm test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"tsc": "tsc",
"test": "vitest",
"prepare": "esbuild src/index.ts --bundle --format=esm --target=esnext --outdir=dist --sourcemap=external && tsc -p tsconfig.d.json",
"build": "esbuild src/main.ts --bundle --format=iife --target=esnext --outfile=public/dist/index.js --sourcemap=inline",
"build": "esbuild src/main.ts --bundle --format=iife --target=esnext --outfile=public/dist/index.js --sourcemap=inline --log-override:import-is-undefined=error",
"start": "serve public",
"chrome": "chrome --no-sandbox --js-flags=--log-deopt,--log-ic,--log-maps,--log-maps-details,--log-internal-timer-events,--prof,--expose-gc,--detailed-line-info --enable-precise-memory-info --user-data-dir=$(PWD)/chrome http://localhost:3000"
},
Expand Down
22 changes: 22 additions & 0 deletions src/frameworks/tansu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ReactiveFramework } from "../util/reactiveFramework";
import { writable, computed, batch } from "@amadeus-it-group/tansu";

export const tansuFramework: ReactiveFramework = {
name: "@amadeus-it-group/tansu",
signal: (initialValue) => {
const w = writable(initialValue);
return {
write: (v) => w.set(v),
read: () => w(),
};
},
computed: (fn) => {
const c = computed(fn);
return {
read: () => c(),
};
},
effect: (fn) => computed(fn).subscribe(() => {}),
withBatch: (fn) => batch(fn),
withBuild: (fn) => fn(),
};