Leaflet.TimeDimension
Leaflet.TimeDimension copied to clipboard
Fire event on input time
Is it possible to fire event when some time come, for example event when 10:17am on 2014-10-30 comes on time player? Need to show some info on some timestamps.
Thanks!
Hi @majadinjar,
you can use the event timeload
, and check if an specific time has been loaded.
Something like this:
var messages = {
'2015-07-08T08:00:00.000Z': 'First message',
'2015-07-09T06:00:00.000Z': 'Second message',
};
map.timeDimension.on('timeload', function(data) {
if (data.time == map.timeDimension.getCurrentTime()) {
var isoDate = new Date(data.time).toISOString();
if (messages.hasOwnProperty(isoDate)) {
console.log(messages[isoDate]);
// show message
} else {
// remove message
}
}
});