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