Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Experimental library implementing scala like actors in javascript.
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
README.md
package.json

README.md

actor

Experimental library implementing Scala like Actors in javascript. Library uses [generators] introduced in JavaScript 1.7 to provide continuation passing mechanism with a linear control flow but asynchronous nature. Idea is to use implement actors in following fashion:

var actor = Actor(function act() {
  // yield saves continuation untill returned promise is resolved
  var data = yield getDataAsync()
  doSomething(data)
})

Actor will use yield to save continuation until promise returned by getDataAsync asynchronous function is fulfilled. After generator will be resumed with a fulfill value, so that it gets assigned to data variable. As a result program is executed sequentially without blocking event-loop.

This library has been tested on Firefox using teleport and on Jetpack. It's very likely that this library will work / won't be to hard to make it work on rhino based platforms like RingoJS.

Examples

Install

npm install actor

Play

teleport activate
open http://localhost:4747/packages/actor/

Prior Art / Source of inspiration

Something went wrong with that request. Please try again.