MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / initialize

Method initialize

codebase/dhtmlxscheduler.es.js:5046–5058  ·  view source on GitHub ↗
(i, t)

Source from the content-addressed store, hash-verified

5044 i.id == this._markers[t].event.id && (this._markers[t].marker.openPopup(), this._markers[t].marker.closeTooltip(), i.lat && i.lng ? this.setView(i.lat, i.lng, this.settings.zoom_after_resolve || this.settings.initial_zoom) : this.setView(this.settings.error_position.lat, this.settings.error_position.lng, this.settings.zoom_after_resolve || this.settings.initial_zoom));
5045 }
5046 initialize(i, t) {
5047 let n = this.scheduler, s = document.createElement("div");
5048 s.className = "mapWrapper", s.id = "mapWrapper", s.style.width = i.style.width, s.style.height = i.style.height, i.appendChild(s);
5049 let a = L.map(s, { center: L.latLng(t.initial_position.lat, t.initial_position.lng), zoom: t.initial_zoom, keyboard: !1 });
5050 L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(a), a.on("dblclick", async function(o) {
5051 let _ = await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${o.latlng.lat}&lon=${o.latlng.lng}&format=json`, { method: "GET", headers: { "Accept-Language": "en" } }).then((r) => r.json());
5052 if (_.address) {
5053 let r = _.address.country;
5054 n.addEventNow({ lat: o.latlng.lat, lng: o.latlng.lng, event_location: r, start_date: n.getState().date, end_date: n.date.add(n.getState().date, n.config.time_step, "minute") });
5055 } else
5056 console.error("unable recieve a position of the event", _.error);
5057 }), this.map = a, this.settings = t;
5058 }
5059 destroy(i) {
5060 for (this.map.remove(); i.firstChild; )
5061 i.firstChild.remove();

Callers

nothing calls this directly

Calls 4

addEventNowMethod · 0.65
getStateMethod · 0.65
addMethod · 0.65
onMethod · 0.45

Tested by

no test coverage detected