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

Function mvc

codebase/sources/dhtmlxscheduler.js:14777–14895  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

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