Get the code!

Industrial Explanation Computer Science Explanation

If you have some functions that you want to get called whenever your data changes, you should use Propagate-JS.

It helps you to avoid manually setting up callbacks

When you use it, your views update automatically when your models do. Check out this demo/tutorial.

Propagate-JS performs a call stack trace to compute the transitive closure over the data dependency of a user's application.

It is reactive programming for the browser.

The primary goal is to implement Incremental Computing in JavaScript without external dependencies.

API Demos

propagate() is a new global.

Call propagate with a function and it returns a tracing version of that function. You must call the returned function at least once for tracing to begin. It will be called again whenever any of its traced dependencies change.

Call propagate with any other argument (data, ie: string, number, etc) and it returns a setter-accessor. Call the accessor with no arguments to retrieve the latest value; call it with a single argument to set the value (and implicitly re-evaluate all traced functions that depend on this value.)

The demos happen to use jQuery to manipulate the DOM, but it is not required to use Propagate-JS.

The Shopping Cart is a simple example, extremely well documented. Reading through the code presented at the bottom is a great first step in learning about Propagate-JS

Colors is a more complex example. shows integration with a jQuery plugin that performs color calculation

Related Work

Copyright (c) 2010 Aaron Blohowiak