Skip to content

Conversation

@Tomperez98
Copy link
Member

@Tomperez98 Tomperez98 commented Dec 4, 2025

This is an initial version. But already working.

// app.ts

import type { Context } from "./src/context";
import { Resonate } from "./src/resonate";

const resonate = Resonate.local({ webapp: true });

function* foo(ctx: Context): Generator {
  const v = yield* ctx.run(bar);
  return v;
}

function bar(ctx: Context): string {
  console.log("hello world!");
  return "hello world";
}

function* fib(ctx: Context, n: number): Generator {
  if (n <= 1) return n;
  const p1 = yield ctx.beginRpc(fib, n - 1);
  const p2 = yield ctx.beginRpc(fib, n - 2);
  return (yield p1) + (yield p2);
}
async function main() {
  resonate.register(foo, { version: 1 });
  resonate.register(fib, { version: 1 });
}
main();
bun run app.ts
// time=2025-12-04T02:50:25.110Z level=INFO msg="starting http server" addr=:8001

resonate invoke fib.2 --func fib --arg 5
resonate get fib.2

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 20.00000% with 124 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.10%. Comparing base (eac9ab5) to head (ccfa685).

Files with missing lines Patch % Lines
dev/network.ts 17.80% 120 Missing ⚠️
src/util.ts 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #374      +/-   ##
==========================================
- Coverage   69.74%   67.10%   -2.65%     
==========================================
  Files          30       30              
  Lines        2740     2894     +154     
  Branches      742      759      +17     
==========================================
+ Hits         1911     1942      +31     
- Misses        828      952     +124     
+ Partials        1        0       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants