O'Reilly logo

Meteor Cookbook by Isaac Strack

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

Making a custom library reactive

Because we so often deal with variables and data, it can go unnoticed that Meteor's reactivity doesn't only work with reactive values. Any function from any JavaScript library can be turned into a reactive provider. This recipe will show you how to create your own reactive providers using the Tracker.depend() and Tracker.changed() commands.

Getting ready

To keep the example simple, we will use a default Meteor project, with a bootstrap package, and a random color generator. Open a terminal window, navigate to where you would like to create your root project, and execute the following commands:

$ meteor create customreactive
$ cd customreactive
$ meteor add twbs:bootstrap
$ meteor add rzymek:randomcolor
$ meteor

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