Skip to content

michbarsinai/BP-javascript-search

 
 

Repository files navigation

BPjs: A Javascript-based Behavioral Programming Library

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.

Change log for the BPjs library.

2016-09-18

  • 🐛 breakUpon handlers are evaluated in the BThread's context, rather than in the BProgram one.

2016-09-13

Client code / Javascript

  • ✨ Updated the logging mechanism from global, single level to 3-level. Code change required: bplog("hello") -> bp.log.info("hello). Also supports warn and fine.
  • 🚮 bpjs is deprecated (but still works). Please use bp 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. Use setBreakUponHandler( function(event){...} ).

Engine/General

  • ✨ Restructured the engine with JS proxies - javascript code has no direct interaction with the Java engine parts!
  • 👍 More unit tests and examples

2016-06-11

  • ✨ BEvents now have an associated data object. See example here

  • ✨ New way of creating BEvents: a static method named named:

    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");
    } );

2016-06-10

  • ✨ Support for breakUpon in bsyncs:

    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.

2016-06-01

  • 🔄 BProgram's setupProgramScope gets a scope as parameter. So no need to call getGlobalScope, and it's clearer what to do.
  • RWBStatement now knows which BThread instantiated it
  • ✨ When a program deadlock, StreamLoggerListener would print the RWBStatements of all BThreads.

Legend:

  • 🔄 Change
  • ✨New feature
  • 🚮 Deprecation

About

Implementation of BP-Search in JS on top of Java using Rhino.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 56.1%
  • Java 34.1%
  • JavaScript 8.4%
  • C 1.1%
  • Other 0.3%