当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript arr.arr_pushMany函数代码示例

本文整理汇总了TypeScript中@utils/arr.arr_pushMany函数的典型用法代码示例。如果您正苦于以下问题:TypeScript arr_pushMany函数的具体用法?TypeScript arr_pushMany怎么用?TypeScript arr_pushMany使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了arr_pushMany函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

    render: function(node, model, ctx, container, ctr, children){
        var run = expression_eval,
            str = node.expression,
            repeat = str.split('..'),
            start = + run(repeat[0] || '', model, ctx, ctr),
            end = + run(repeat[1] || '', model, ctx, ctr);

        if (start !== start || end !== end) {
            log_error('Repeat attribute(from..to) invalid', str);
            return;
        }

        var nodes = node.nodes;
        var arr = [];
        var i = start - 1;
        while (++i < end) {
            arr.push(compo_init(
                'repeat::item',
                nodes,
                model,
                i,
                container,
                ctr
            ));
        }

        var els = [];
        builder_build(arr, model, ctx, container, ctr, els);
        arr_pushMany(children, els);
    }
开发者ID:atmajs,项目名称:MaskJS,代码行数:30,代码来源:repeat.ts

示例2: function

    render: function(node, model, ctx, container, ctr, children){
        var els = [];
        builder_build(node.nodes, model, ctx, container, ctr, els);
        arr_pushMany(children, els)

        var visible = expression_eval(node.expression, model, ctx, ctr);
        toggle(els, visible);
    }
开发者ID:atmajs,项目名称:MaskJS,代码行数:8,代码来源:visible.ts

示例3: build_Static

	function build_Static(static_, node, model, ctx, container, ctr, children) {
		var Ctor = static_.__Ctor,
			wasRendered = false,
			elements,
			compo,
			clone;

		if (Ctor != null) {
			clone = new Ctor(node, ctr);
		}
		else {
			clone = static_;

			for (var key in node)
				clone[key] = node[key];

			clone.parent = ctr;
		}

		var attr = clone.attr;
		if (attr != null) {
			for (var key in attr) {
				if (typeof attr[key] === 'function')
					attr[key] = attr[key]('attr', model, ctx, container, ctr, key);
			}
		}

		if (is_Function(clone.renderStart)) {
			clone.renderStart(model, ctx, container, ctr, children);
		}

		clone.ID = ++BuilderData.id;
		compo_addChild(ctr, clone);

		var i = ctr.components.length - 1;
		if (is_Function(clone.render)){
			wasRendered = true;
			elements = clone.render(model, ctx, container, ctr, children);
			arr_pushMany(children, elements);

			if (is_Function(clone.renderEnd)) {
				compo = clone.renderEnd(elements, model, ctx, container, ctr);
				if (compo != null) {
					// overriden
					ctr.components[i] = compo;
					compo.components  = clone.components == null
						? ctr.components.splice(i + 1)
						: clone.components
						;
				}
			}
		}

		return wasRendered === true ? null : clone;
	}
开发者ID:atmajs,项目名称:MaskJS,代码行数:55,代码来源:build_component.ts

示例4: build_NodeAsCompo

	function build_NodeAsCompo(node, model, ctx, container, ctr, childs){
		node.ID = ++BuilderData.id;

		compo_addChild(ctr, node);

		if (node.model == null)
			node.model = model;

		var els = node.elements = [];
		if (node.render) {
			node.render(node.model, ctx, container, ctr, els);
		} else {
			build(node.nodes, node.model, ctx, container, node, els);
		}

		if (childs != null && els.length !== 0) {
			arr_pushMany(childs, els);
		}
		return null;
	}
开发者ID:atmajs,项目名称:MaskJS,代码行数:20,代码来源:build_component.ts

示例5: build


//.........这里部分代码省略.........
            build_textNode(node, model, ctx, container, ctr);
            return container;
        }

        // Dom.SET
        if (type === 10) {
            build_many(node, model, ctx, container, ctr, children);
            return container;
        }

        // Dom.STATEMENT
        if (type === 15) {
            var Handler = custom_Statements[tagName];
            if (Handler == null) {
                if (custom_Tags[tagName] != null || builder_findAndRegisterCompo(ctr, tagName)) {
                    // Dom.COMPONENT
                    type = 4;
                } else {
                    log_error('<mask: statement is undefined>', tagName);
                    return container;
                }
            }
            if (type === 15) {
                Handler.render(node, model, ctx, container, ctr, children);
                return container;
            }
        }

        // Dom.NODE
        if (type === 1) {
            container = build_node(node, model, ctx, container, ctr, children);
            children = null;
        }

        // Dom.COMPONENT
        if (type === 4) {
            ctr = build_compo(node, model, ctx, container, ctr, children);
            if (ctr == null) {
                return container;
            }
            elements = [];
            node = ctr;

            if (ctr.model !== model && ctr.model != null) {
                model = ctr.model;
            }
        }

        var nodes = node.nodes;
        if (nodes != null) {
            if (children != null && elements == null) {
                elements = children;
            }
            if (is_ArrayLike(nodes)) {
                build_many(nodes, model, ctx, container, ctr, elements);			
            } else {
                build(nodes, model, ctx, container, ctr, elements);
            }
        }

        if (type === 4) {

            // use or override custom attr handlers
            // in Compo.handlers.attr object
            // but only on a component, not a tag ctr
            if (node.tagName == null) {
                var attrHandlers = node.handlers && node.handlers.attr,
                    attrFn,
                    val,
                    key;

                for (key in node.attr) {

                    val = node.attr[key];

                    if (val == null)
                        continue;

                    attrFn = null;

                    if (attrHandlers != null && is_Function(attrHandlers[key]))
                        attrFn = attrHandlers[key];

                    if (attrFn == null && custom_Attributes[key] != null)
                        attrFn = custom_Attributes[key];

                    if (attrFn != null)
                        attrFn(node, val, model, ctx, elements[0], ctr);
                }
            }

            if (is_Function(node.renderEnd))
                node.renderEnd(elements, model, ctx, container);
        }

        if (children != null && elements != null && children !== elements)
            arr_pushMany(children, elements);

        return container;
    }
开发者ID:atmajs,项目名称:MaskJS,代码行数:101,代码来源:build.ts


注:本文中的@utils/arr.arr_pushMany函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。