@actorize/core

Actorize helps building scalable js apps with a messaging system

Usage no npm install needed!

<script type="module">
  import actorizeCore from 'https://cdn.skypack.dev/@actorize/core';
</script>

README

@actorize/core

Getting Started

$ npm install @actorize/core
# or
$ yarn add @actorize/core
import {
  createDirector,
  createStore,
} from '@actorize/core';

const director = createDirector({
  store: createStore(),
});

const actorOne = director.registerActor('one');
actorOne.onMessage((msgs) => {
  if (msgs[0].payload === 'DO_SOMETHING') {
    console.log('I DID SOMETHING');
  }
});

const actorTwo = director.registerActor('two');
actorTwo.sendMessage('one', 'DO_SOMETHING');