O'Reilly logo

Learning Bing Maps API by Artan Sinani

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

The poll

The approach we have taken throughout this book is to extend the Microsoft.Maps API by means of modules. This project is not an exception. So far, our project folder holds the index.html file and the learningTheme folder. Let's add a poll directory, inside which we create the poll.js and poll.css files.

Let's start with our familiar module skeleton inside poll.js, as shown in the following code snippet:

(function() {
  var lbm = window.lbm || {};

  lbm.Poll = function(map, $) {
    this._map = map;
    this.$ = $;
  };

  Microsoft.Maps.moduleLoaded('lbm.Poll');
})();

The Poll module is attached to the lbm namespace so that the global scope does not get cluttered. Its constructor accepts an instance of the map and a jQuery object as its arguments.

Now it's ...

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