openlayers/ol3 — pull request #1036 by twpayne (2013-09-18 15:03:12+00:00)
Title: Asynchronos tile URL calculation

This PR, developed with @elemoine and @vmx, allows the way that tiles are loaded to be overridden. This allows tile URLs to be generated asynchronously, as requested by @vmx in #792. This functionality is needed to eventually support tiles accessed with JavaScripts File API, or tiles stored in some databases, such as PouchDB.

As a demonstration of its use, here a one second `setTimeout` is used to simulate asynchronous tile URL lookup:
```javascript
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.XYZ({
tileLoadFunction: function(imageTile, src) {
window.setTimeout(function() {
imageTile.getImage().src = src;
}, 1);
},
url: 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'
})
})
]
// ...
});
```