0.10.2 • Published 3 years ago

@little-bonsai/ingrates v0.10.2

Weekly downloads
17
License
MIT
Repository
github
Last release
3 years ago

Ingrates

An isomorphic actor system

minzipped size version license


ingrates is an actor system based on async generators. I provides a very small API surface area and tries to remain relatively out of your way.

You can find docs at ingrates.littlebonsai.co.uk

Example

import createActorSystem from "@little-bonsai/ingrates";

async function* ChildActor({ parent, dispatch }, firstname, lastname) {
  const msg = yield;

  if (msg.type === "HELLO") {
    dispatch(msg.src, {
      type: "GOODBYE",
      msg: \`say goodbye to \${firstname} \${lastname}\`,
    });
  }
}

async function* RootActor({ spawn, self, dispatch }) {
  const myChild = spawn(ChildActor, "Bert", "Jurnegen");

  dispatch(myChild, { type: "HELLO" });

  while (true) {
    const msg = yield;
    if (msg.type === "GOODBYE") {
      console.log("Please... my son. He's very sick");
    }
  }
}


createActorSystem()(RootActor);
0.10.2

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.2

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0-alpha.0

4 years ago

0.2.0

4 years ago

0.2.0-alpha.1

4 years ago

0.1.0

4 years ago