shakespeare
Shakespeare is a simplified Actor model based on event emitters.
Shakespeare receives an instantiated event emitter via its constuctor. It then exposes 'send' and 'spawn' methods...
Install
npm install shakespeare --save
var _ee = ;var ee = ; var play = ee; play; play;
Methods
send
play;
spawn
play;
Actors
Everything looks like an event emitter except for the extra pid argument which is passed to the event handler or 'actor'. An actor in shakespeare is simply an augmented event emitter with a unique pid for each function handler.
Basic actor
{ if ! this instanceof actor_with_state return ; thisdata = 0; var self = this; this { console; selfdata += messagedata; console; } this { return thisdata; }} var actor = ;var actor_pid = play;
Actors with behaviours
{ if ! this instanceof actor_with_behaviour return ; var self = this; this { play; } this { play; } this { if messageimportant self; else self; }} var actor = ; var actor_pid = play