I think the Cloudflare Agent class has that kind of Alarm system
I think the Cloudflare Agent class has that kind of Alarm system
There is Brayden's elegant Alarm class but it's not documented, and by default requires your DO extend the Actor base class unless you duplicate what that base class does manually.You actually don't need the Actor base class. I am a fan of toolkits personally, so we tried
actors package to make it available on its own, only depending on the ctx.storage of SQLite Durable Objects.cloudflare:test's runDurableObjectAlarm, so I spent the rest of the day adding alarm testing support to @lumenize/testing, which requires no manual triggering of alarms. I switched the docs linked above over to using it so there is about half the boilerplate that there was before.
using CloudFlare and Durable objects under the hoodThe notion of "write once deploy anywhere" is appealing but it's extremely challenging from many dimensions (performance, DX, etc.). Think of it as a tradeoff between portability and avoiding leaky abstractions. This would be super-leaky and it would always lag DO features.

tsconfig.json?wrangler.jsoncwrangler.jsoncimport { DurableObject } from "cloudflare:workers";cloudflare:workerscloudflare:workersclass_nameclass_nameworker-configuration.d.tsnpx wrangler typesnode:mainSuperDO// src/index.ts, or whatever their main file is
export { SuperDO } from "justin_utils"; // class_name: SuperDO
export { SuperDO as MyMadeUpDOClassName } from "justin_utils"; // class_name: MyMadeUpDOClassName