In a nutshell. You can forget about callbacks and events and work as if all data was local and stable.
The following snippet shows how easy it is to work with an Ajax Datasource, a Firebase stream and a stream of data from an HTML text input. Notice that, even though they are completely different in nature, they can all be treated like normal functions and there are no callbacks or events.
And this completely reactive of course: If data changes the text value of
#output will be updated accordingly.
// radioactive.data exposes popular datasources as reactive streams// but you can easily write your ownvar rates = radioactivedata"?";var currency = radioactivedata"#currency-selector-input";var bitcoin = radioactivedata"";radioactivereactvar value = bitcoin * ratesratescurrency;$"#output"text "1 BTC = " + currency + " " + value ;
You can completely abstract yourself from "where the data comes from" and "how often it changes" and let radioactive.react do all the heavy lifting for you.
This leads to purely functional, highly scalable and mantainable code. You can easily unit test your app or replace parts of your code with mock datasources. Here's how a more modularized version of the previous code might look like:
var rates = radioactivedata"?";var currency = radioactivedata"#currency-selector-input";var bitcoin = radioactivedata"";// notice that this function is wrapping an Ajax call and a Firebase stream// but you can completely abstact yourself from that factreturn bitcoin * ratesratescurr;radioactivereact$"#output"text "1 BTC = " + currency + " " + getCurrentBitcoinValue currency ;
You can find more examples on the /examples folder.
radioactive.data knows how to connect to a series of popular datasources out-of-the box, but the real power of Radioactive is that it is highly extensible. There are many ways to connect your own streams or async services. Third party integrations are also available.
We suggest you read The Radioactive Tutorial.
But if you are in a hurry:
$ bower install radioactive
$ npm install radioactive
Depending on where you come from, there are many ways to describe Radioactive.
Next generation UI frameworks can leverage Radioactive as their data-binding layer. Data source publishers can use Radioactive to provide a more user-friendly API.