Created
July 3, 2012 10:07
-
-
Save mourner/3038879 to your computer and use it in GitHub Desktop.
Leaflet API simplification proposal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = new L.Map('map'); | |
map.setView(new L.LatLng(51.505, -0.09), 13); | |
var cloudmade = new L.TileLayer('http://{s}.tile.cloudmade.com/.../{z}/{x}/{y}.png', { | |
attribution: '[...]' | |
}); | |
map.addLayer(cloudmade); | |
var marker = new L.Marker(new L.LatLng(51.5, -0.09)); | |
marker.bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup(); | |
map.addLayer(marker); | |
var circle = new L.Circle(new L.LatLng(51.508, -0.11), 500, {color: '#f03', opacity: 0.7}); | |
circle.bindPopup("I am a circle."); | |
map.addLayer(circle); | |
var polygon = new L.Polygon([ | |
new L.LatLng(51.509, -0.08), | |
new L.LatLng(51.503, -0.06), | |
new L.LatLng(51.51, -0.047) | |
]); | |
polygon.bindPopup("I am a polygon."); | |
map.addLayer(polygon); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = L.map('map').setView([51.505, -0.09], 13); | |
var cloudmade = L.tileLayer('http://{s}.tile.cloudmade.com/.../{z}/{x}/{y}.png', { | |
attribution: '[...]' | |
}).addTo(map); | |
L.marker([51.5, -0.09]) | |
.bindPopup("<b>Hello world!</b><br />I am a popup.") | |
.addTo(map) | |
.openPopup(); | |
L.circle([51.508, -0.11], 500, {color: '#f03', opacity: 0.7}) | |
.bindPopup("I am a circle.") | |
.addTo(map); | |
L.polygon([ | |
[51.509, -0.08], | |
[51.503, -0.06], | |
[51.51, -0.047]]) | |
.bindPopup("I am a polygon.") | |
.addTo(map); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yep, all method that don't explicitly return some value (like
getCenter
) return the object itself for chaining.