This repository contains a javascript-based BP library. It uses the Rhino engine, as some of its features require continuations and Rhino seems to be the only one to support it as this point.
Current version lives in BP-javascript. The other BP libraries will later be merged or updated.
This library was originally created my @moshewe, but was refactored extensively by @michbarsinai, who currently maintains it.
- 🐛
breakUpon
handlers are evaluated in theBThread
's context, rather than in theBProgram
one.
- ✨ Updated the logging mechanism from global, single level to 3-level. Code change required:
bplog("hello") -> bp.log.info("hello)
. Also supportswarn
andfine
. - 🚮
bpjs
is deprecated (but still works). Please usebp
now. - 🚮 positional bsync deprecated (but still works). Please use the named-argument variant
bsync({request:....})
. - 🚮 BThread is not exposed in Javascript via
bt
(that was never used). - ✨ BThreads can now enqueue external events using
bp.enqueueExternalEvent()
. - ✨ BThreads can now specify a function that will be executed if they are removed because an event in their
breakUpon
event set was selected. UsesetBreakUponHandler( function(event){...} )
.
- ✨ Restructured the engine with JS proxies - javascript code has no direct interaction with the Java engine parts!
- 👍 More unit tests and examples
-
✨ BEvents now have an associated
data
object. See example here -
✨ New way of creating
BEvent
s: a static method namednamed
:new BEvent("1stEvent") // old BEvent.named("1stEvent") // new and English-like.
Future usaged include the ability to reuse event instances, but we're not there yet.
-
✨ Added support for Javascript definition of event sets:
var sampleSet = bpjs.EventSet( function(e){ return e.getName().startsWith("1st"); } );
-
✨ Support for
breakUpon
inbsync
s:bsync( {request:A, waitFor:B, block:C, breakUpon:D})
-
✨
SingleResourceBProgram
- a convenience class for the common case of having a BProgram that consists of a single file.
- 🔄 BProgram's
setupProgramScope
gets a scope as parameter. So no need to callgetGlobalScope
, and it's clearer what to do. - ✨
RWBStatement
now knows which BThread instantiated it - ✨ When a program deadlock,
StreamLoggerListener
would print theRWBStatement
s of allBThreads
.
Legend:
- 🔄 Change
- ✨New feature
- 🚮 Deprecation