overdb
v0.0.10
Published
Simple virtual actor system
Downloads
3
Readme
overdb
Simple virtual actor system
class Model {
private counter = 0;
async hello() {
this.counter++;
return this.counter;
}
}
inject.when(MemoryPort).createSelf().asSingleton();
const c = await spawn(new Model());
const r = await c.hello();
const c2 = await actor(Model);
const r2 = await c2.hello();
expect(r2).toBe(2);
expect(await c.hello()).toBe(3);
const packed = Packer.pack(c);
const unpacked = Packer.unpack(packed) as Model; // ?
const result = await unpacked.hello() // ?
expect(result).toBe(4);