-
Book Overview & Buying
-
Table Of Contents
OpenLayers 3.x Cookbook - Second Edition
By :
This chapter is focused on events, which is an important concept in any JavaScript application. Although this chapter is brief, the concepts explained here are very important to understand when working with OpenLayers and mapping applications in general.
Events are fundamental in JavaScript. They are the impulses that allow us to produce a reaction. As programmers of a mapping application, we are interested in reacting when the map zoom changes, when a layer is loaded, or when a feature is added to a layer. Every class, which is susceptible to emit events, is responsible for managing its listeners (those interested in being notified when an event is fired) and also to emit events under certain circumstances.
For example, we can register a function handler that listens for the change:resolution event on the OpenLayers map view instance. Every time the view instance changes its zoom level, it has the responsibility to trigger the change:resolution event, so all its listeners will...
Change the font size
Change margin width
Change background colour