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

Function mvc

codebase/sources/dhtmlxscheduler.es.js:14773–14891  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

14771 };
14772}
14773function mvc(scheduler2) {
14774 var cfg = { use_id: false };
14775 function sanitize(ev) {
14776 var obj = {};
14777 for (var key in ev)
14778 if (key.indexOf("_") !== 0)
14779 obj[key] = ev[key];
14780 if (!cfg.use_id)
14781 delete obj.id;
14782 return obj;
14783 }
14784 var update_timer;
14785 function update_view() {
14786 clearTimeout(update_timer);
14787 update_timer = setTimeout(function() {
14788 if (scheduler2.$destroyed) {
14789 return true;
14790 }
14791 scheduler2.updateView();
14792 }, 1);
14793 }
14794 function _start_ext_load(cal) {
14795 cal._loading = true;
14796 cal._not_render = true;
14797 cal.callEvent("onXLS", []);
14798 }
14799 function _finish_ext_load(cal) {
14800 cal._not_render = false;
14801 if (cal._render_wait)
14802 cal.render_view_data();
14803 cal._loading = false;
14804 cal.callEvent("onXLE", []);
14805 }
14806 function _get_id(model) {
14807 return cfg.use_id ? model.id : model.cid;
14808 }
14809 scheduler2.backbone = function(events, config) {
14810 if (config)
14811 cfg = config;
14812 events.bind("change", function(model, info) {
14813 var cid = _get_id(model);
14814 var ev = scheduler2._events[cid] = model.toJSON();
14815 ev.id = cid;
14816 scheduler2._init_event(ev);
14817 update_view();
14818 });
14819 events.bind("remove", function(model, changes) {
14820 var cid = _get_id(model);
14821 if (scheduler2._events[cid])
14822 scheduler2.deleteEvent(cid);
14823 });
14824 var queue = [];
14825 function add_from_queue() {
14826 if (scheduler2.$destroyed) {
14827 return true;
14828 }
14829 if (queue.length) {
14830 scheduler2.parse(queue, "json");

Callers

nothing calls this directly

Calls 12

_get_idFunction · 0.70
update_viewFunction · 0.70
_start_ext_loadFunction · 0.70
_finish_ext_loadFunction · 0.70
sanitizeFunction · 0.70
bindMethod · 0.65
toJSONMethod · 0.65
deleteEventMethod · 0.65
attachEventMethod · 0.65
getEventMethod · 0.65
changeEventIdMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected