2019-04-04 10:19:29 +02:00
|
|
|
/* exported WorldInfoDisplay */
|
2019-12-29 15:43:46 +01:00
|
|
|
import WorldStats from '../components/WorldStats.js';
|
2019-05-14 16:03:21 +02:00
|
|
|
|
2019-02-04 21:25:30 +01:00
|
|
|
// coord display
|
2019-06-11 14:16:41 +02:00
|
|
|
export default L.Control.extend({
|
2019-02-04 21:25:30 +01:00
|
|
|
initialize: function(wsChannel, opts) {
|
|
|
|
L.Control.prototype.initialize.call(this, opts);
|
|
|
|
this.wsChannel = wsChannel;
|
|
|
|
},
|
|
|
|
|
2019-04-04 10:19:29 +02:00
|
|
|
onAdd: function() {
|
2019-02-04 21:25:30 +01:00
|
|
|
var div = L.DomUtil.create('div', 'leaflet-bar leaflet-custom-display');
|
|
|
|
|
|
|
|
this.wsChannel.addListener("minetest-info", function(info){
|
2019-12-29 15:43:46 +01:00
|
|
|
m.render(div, WorldStats(info));
|
2019-02-04 21:25:30 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
return div;
|
|
|
|
}
|
|
|
|
});
|