extend

webix.extend(base, source, force)

webix.extend helper.

Please look into the linked official documentation.

References

helpers
assert().

External references

Official documentation page.

Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
webix.extend = function(base, source, force){
    webix.assert(base,"Invalid mixing target");
    webix.assert(source,"Invalid mixing source");

    if (base.$protoWait){
        webix.PowerArray.insertAt.call(base.$protoWait, source,1);
        return base;
    }

    //copy methods, overwrite existing ones in case of conflict
    for (var method in source)
        if (!base[method] || force)
            base[method] = source[method];

    //in case of defaults - preffer top one
    if (source.defaults)
        webix.extend(base.defaults, source.defaults);

    //if source object has init code - call init against target
    if (source.$init)
        source.$init.call(base);

    return base;
};

//copies methods and properties from source to the target from all levels