本文整理匯總了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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}