Skip to content

Support for visualization/analysis/debugging tools #273

@raimohanska

Description

@raimohanska

In the feature/dependency-graph-dispatch, I've made some improvement that will enable the implementation of development tools that can, for instance, visualize the event network and event flow going on. The improvements include

observable.deps()

Returns an array of dependencies that the Observable has. For instance, for a.map(function() {}), the deps would return [a]. This method returns the "visible" dependencies only, skipping internal details. This method is thus suitable for visualization tools.

Internally, many combinator functions depend on other combinators to create intermediate Observables that the result will actually depend on. The deps method will skip these internal dependencies.

observable.toString()

Returns a nice textual presentation of the stream. Covered in #265.

observable.internalDeps()

Returns the true dependencies of the observable, including the intermediate "hidden" Observables. This method is for Bacon.js internal purposes but could be useful for debugging/analysis tools as well.

observable.desc()

Returns a structured version of what toString returns. The structured description is an object that contains the fields context, method and args. For example, for Bacon.fromArray([1,2,3]).desc() you'd get

{ context: Bacon, method: "fromArray", args: [[1,2,3]] }

Bacon.spy(f)

Adds your funcion as a "spy" that will get notified on all new Observables. This will allow a visualization/analytis tool to spy on all Bacon activity. Current implementation just calls your function, but maybe, it should allow you to wrap all created Observables in your own wrapper to make spying even easier? This would enable AOFRP (aspect oriented functional reactive programming) lol.

I'm planning to include this improvement in release 0.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions