本文整理汇总了TypeScript中@utils/coll.coll_each函数的典型用法代码示例。如果您正苦于以下问题:TypeScript coll_each函数的具体用法?TypeScript coll_each怎么用?TypeScript coll_each使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了coll_each函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
splitNodes_: function(){
var map = {
'@progress': 'progressNodes',
'@fail': 'errorNodes',
'@done': 'completeNodes',
};
coll_each(this.nodes, function(node){
var name = node.tagName,
nodes = node.nodes;
var prop = map[name];
if (prop == null) {
prop = 'completeNodes';
nodes = [ node ];
}
if (node.expression) {
this[prop + 'Expr'] = node.expression;
}
var current = this[prop];
if (current == null) {
this[prop] = nodes;
return;
}
this[prop] = Array
.prototype
.concat
.call(current, nodes);
}, this);
this.nodes = null;
},
示例2: removeAttr
import { coll_each } from '@utils/coll';
import { is_String } from '@utils/is';
import { obj_extend } from '@utils/obj';
import { _mask_ensureTmplFn } from '../scope-vars';
export const ManipAttr = {
removeAttr (key){
return coll_each(this, function(node){
node.attr[key] = null;
});
},
attr (mix, val){
if (arguments.length === 1 && is_String(mix)) {
return this.length !== 0 ? this[0].attr[mix] : null;
}
function asString(node, key, val){
node.attr[key] = _mask_ensureTmplFn(val);
}
function asObject(node, obj){
for(var key in obj){
asString(node, key, obj[key]);
}
}
var fn = is_String(mix) ? asString : asObject;
return coll_each(this, function(node){
fn(node, mix, val);
});
},
prop (key, val) {
示例3: function
ManipDom[method] = function(){
return coll_each(this, Methods_[method]);
};
示例4: function
ManipClass[method + 'Class'] = function(klass) {
return coll_each(this, function(node){
fn(node, klass);
});
};