O'Reilly logo

Mastering Reactive JavaScript by Erich de Souza Oliveira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Observables from other sources

The bacon.js has other built-in methods to create observables from common EventStream sources. The objective of this chapter is not to explain all the functions of the bacon.js API. You can check out other possible EventStream sources by referring to bacon.js documentation. The last important method to create an EventStream is the method that lets you create an EventStream from any arbitrary source. This is the fromBinder() method.

The fromBinder() method has the following signature:

Bacon.fromBinder(publisher); 

It receives a publisher function as a parameter; this is a function with only one parameter that lets you push events for your EventStream, as illustrated in the following example:

 var myCustomEventStream ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required