Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Leaflet.js Essentials

You're reading from   Leaflet.js Essentials Create interactive, mobile-friendly mapping applications using the incredibly light yet powerful Leaflet.js platform.

Arrow left icon
Product type Paperback
Published in Aug 2014
Publisher
ISBN-13 9781783554812
Length 180 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Building Leaflet applications with Node.js

Node.js is a JavaScript-based platform that builds non-blocking applications. The non-blocking feature is what has made Node.js extremely popular. Think about how you code. You complete tasks step-by-step. You might jump around in your code, calling functions and responding to events, but you wait until one action is complete before you start the next. With Node.js, you assign callbacks and move on to the next task or handle the next request. Take a database search, for example. In the following pseudocode, you retrieve a record and do something with it in the traditional manner:

var result = SELECT * from MyTable;
document.getElementById['results'].innerHTML= result;

In the example, you wait for the database to send back the results, and then you move on to displaying them. In Node.js, you would do something similar but assign a callback function, as shown in the following example:

function showResults(){document.getElementById['results...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image