本文整理汇总了TypeScript中@core/custom/exports.customTag_get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript customTag_get函数的具体用法?TypeScript customTag_get怎么用?TypeScript customTag_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了customTag_get函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: compo_extends
function compo_extends(extends_, model, ctr) {
var args = [];
if (extends_ == null)
return args;
var imax = extends_.length,
i = -1,
await = 0, x;
while( ++i < imax ){
x = extends_[i];
if (x.compo) {
var compo = customTag_get(x.compo, ctr);
if (compo != null) {
args.unshift(compo);
continue;
}
var obj = expression_eval(x.compo, model, null, ctr);
if (obj != null) {
args.unshift(obj);
continue;
}
log_error('Nor component, nor scoped data is resolved:', x.compo);
continue;
}
}
return args;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:28,代码来源:Define.ts
示例2: function
render: function (node, model, ctx, container, ctr, els) {
var name = attr_first(node.attr);
var Compo = customTag_get(name, ctr);
var template;
if (Compo != null) {
template = Compo.prototype.template || Compo.prototype.nodes;
if (template != null) {
template = mask_merge(template, node.nodes);
}
}
else {
template = Templates.get(name);
}
if (template != null) {
builder_build(template, model, ctx, container, ctr, els);
}
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:18,代码来源:template.ts
示例3: compo_inherit
export function compo_inherit (Proto, Extends){
var imax = Extends.length,
i = imax,
ctors = [],
x, hasBase;
while( --i > -1){
x = Extends[i];
if (typeof x === 'string') {
x = customTag_get(x);
if (x != null && x.name === 'Resolver') {
log_error('Inheritance error: private component');
x = null;
}
}
if (x == null) {
log_error('Base component not defined', Extends[i]);
continue;
}
if (typeof x === 'function') {
hasBase = hasBase || x.name === COMPO_CTOR_NAME;
ctors.push(x);
x = x.prototype;
}
inherit_(Proto, x, 'node');
}
i = -1;
imax = ctors.length;
if (imax > 0) {
if (Proto.hasOwnProperty('constructor'))
ctors.unshift(Proto.constructor);
Proto.constructor = joinCtors_(ctors);
}
var meta = Proto.meta;
if (meta == null)
meta = Proto.meta = {};
if (meta.template == null)
meta.template = 'merge';
return hasBase;
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:43,代码来源:compo_inherit.ts
示例4: if
ctx = null;
} else if (model && model.nodeType != null){
container = model;
model = null;
}
}
var node;
function createNode(compo) {
node = {
controller: compo,
type: Dom.COMPONENT
};
}
if (typeof mix === 'string'){
if (/^[^\s]+$/.test(mix)) {
var compo = customTag_get(mix);
if (compo == null)
throw Error('Component not found: ' + mix);
createNode(compo);
} else {
createNode(compo_create([{
template: mix
}]));
}
}
else if (typeof mix === 'function') {
createNode(mix);
}
if (parent == null && container != null) {
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:CompoStatics.ts
示例5: UTest
import { listeners_on, listeners_off } from '@core/util/listeners'
import {
customTag_get,
customTag_define,
customTag_registerFromTemplate
} from '@core/custom/exports'
import { renderer_render } from '@core/renderer/exports'
import { Compo } from '@compo/exports'
import '@core/feature/modules/exports'
UTest({
'from template' : {
'define' () {
var compo = customTag_get('FooFromTmpl');
eq_(compo, null);
customTag_registerFromTemplate(`
define FooFromTmpl {
h4 > 'FooFromTmpl'
}
`)
var compo = customTag_get('FooFromTmpl');
is_(compo, 'Function');
var dom = renderer_render('FooFromTmpl');
return UTest.domtest(dom, `
find('h4') > text FooFromTmpl;
`);
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:register.spec.ts
示例6: _cloneNode
function _cloneNode(node, placeholders, tmplNode, clonedParent) {
var tagName = node.tagName || node.compoName;
var deepClone = true;
switch (tagName) {
case ':template':
var id = interpolate_str_(node.attr.id, placeholders, tmplNode);
Templates.register(id, node.nodes);
return null;
case ':import':
var id = interpolate_str_(node.attr.id, placeholders, tmplNode),
nodes = Templates.resolve(node, id);
return _merge(nodes, placeholders, tmplNode, clonedParent);
case 'function':
case 'define':
case 'let':
case 'var':
case 'import':
case 'script':
case 'style':
case 'slot':
case 'event':
case 'await':
return node;
case 'include':
var tagName = node.attr.id;
if (tagName == null) {
tagName = attr_first(node.attr);
}
tagName = interpolate_str_(tagName, placeholders, tmplNode);
var handler = customTag_get(tagName, tmplNode);
if (handler != null) {
var proto = handler.prototype;
var tmpl = proto.template || proto.nodes;
placeholders.$isEmpty = false;
var next = _resolvePlaceholders(
node.nodes,
node.nodes,
new Placeholders(placeholders, node.nodes)
);
return _merge(tmpl, next, tmplNode, clonedParent);
}
break;
default:
var handler = customTag_get(tagName, tmplNode);
if (handler != null) {
placeholders.$compos[tagName] = handler;
var proto = handler.prototype;
if (proto && proto.meta != null && proto.meta.template !== 'merge') {
deepClone = false;
}
}
break;
}
var outnode = _cloneNodeShallow(node, clonedParent, placeholders, tmplNode);
if (deepClone === true && outnode.nodes) {
outnode.nodes = _merge(node.nodes, placeholders, tmplNode, outnode);
}
return outnode;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:62,代码来源:merge.ts
注:本文中的@core/custom/exports.customTag_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论