protoUI

webix.protoUI([see official doc])

webix.protoUI helper.

Please look into the linked official documentation.

References

helpers
log(), type(), ui().

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
webix.protoUI = function(){
    if (webix.debug_proto)
        webix.log("UI registered: "+arguments[0].name);

    var origins = arguments;
    var selfname = origins[0].name;

    var t = function(data){
        if (!t)
            return webix.ui[selfname].prototype;

        var origins = t.$protoWait;
        if (origins){
            var params = [origins[0]];

            for (var i=1; i < origins.length; i++){
                params[i] = origins[i];

                if (params[i].$protoWait)
                    params[i] = params[i].call(webix, params[i].name);

                if (params[i].prototype && params[i].prototype.name)
                    webix.ui[params[i].prototype.name] = params[i];
            }
            webix.ui[selfname] = webix.proto.apply(webix, params);

            if (t._webix_type_wait)
                for (var i=0; i < t._webix_type_wait.length; i++)
                    webix.type(webix.ui[selfname], t._webix_type_wait[i]);

            t = origins = null;
        }

        if (this != webix)
            return new webix.ui[selfname](data);
        else
            return webix.ui[selfname];
    };
    t.$protoWait = Array.prototype.slice.call(arguments, 0);
    return (webix.ui[selfname]=t);
};