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

Method initialize

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

Source from the content-addressed store, hash-verified

5105 }
5106 }
5107 initialize(i, t) {
5108 let n = this.scheduler;
5109 mapboxgl.accessToken = t.accessToken;
5110 const s = new mapboxgl.Map({ container: i, center: [t.initial_position.lng, t.initial_position.lat], zoom: t.initial_zoom + 1 });
5111 s.on("dblclick", async function(a) {
5112 let o = await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${a.lngLat.lng},${a.lngLat.lat}.json?access_token=${t.accessToken}`).then((_) => _.json());
5113 if (o.features) {
5114 let _ = o.features[0].place_name;
5115 n.addEventNow({ lat: a.lngLat.lat, lng: a.lngLat.lng, event_location: _, start_date: n.getState().date, end_date: n.date.add(n.getState().date, n.config.time_step, "minute") });
5116 } else
5117 console.error("unable recieve a position of the event");
5118 }), this.map = s, this.settings = t;
5119 }
5120 destroy(i) {
5121 for (this.map.remove(); i.firstChild; )
5122 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