本文整理汇总了TypeScript中@core/renderer/exports.renderer_render函数的典型用法代码示例。如果您正苦于以下问题:TypeScript renderer_render函数的具体用法?TypeScript renderer_render怎么用?TypeScript renderer_render使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了renderer_render函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
'expressions': function(){
var dom = renderer_render('"~[a] ~[: b[\'sub\'] ]"', {
a: 'A',
b: { sub: 'Sub!'}
});
eq_(dom.textContent, 'A Sub!');
},
示例2: function
domLib.fn[method] = function(template, model, ctr, ctx){
if (this.length === 0) {
//#if (DEBUG)
log_warn('<jcompo> $.', method, '- no element was selected(found)');
//#endif
return this;
}
if (this.length > 1) {
//#if (DEBUG)
log_warn('<jcompo> $.', method, ' can insert only to one element. Fix is comming ...');
//#endif
}
if (ctr == null) {
ctr = index < 2
? this.compo()
: this.parent().compo()
;
}
var isUnsafe = false;
if (ctr == null) {
ctr = {};
isUnsafe = true;
}
if (ctr.components == null) {
ctr.components = [];
}
var compos = ctr.components,
i = compos.length,
fragment = renderer_render(template, model, ctx, null, ctr);
var self = this[jQ_Methods[index]](fragment),
imax = compos.length;
for (; i < imax; i++) {
CompoSignals.signal.emitIn(compos[i], 'domInsert');
}
if (isUnsafe && imax !== 0) {
// if DEBUG
log_warn(
'$.'
, method
, '- parent controller was not found in Elements DOM.'
, 'This can lead to memory leaks.'
);
log_warn(
'Specify the controller directly, via $.'
, method
, '(template[, model, controller, ctx])'
);
// endif
}
return self;
};
示例3: renderer_render
]).forEach(function(row){
expect = row.expect;
expect.unshift('Mask::Log');
renderer_render(
row.data[0], row.data[1], null, null, row[3]
);
})
示例4: eval
.pipe(pckg => {
eval(pckg.script);
$('<style>').text(pckg.style).appendTo('body');
var dom = renderer_render(pckg.mask);
return UTest.domtest(dom, `
find ('.foo') {
text Foo;
}
`)
});
示例5: customTag_define
},
'should load async javascripts scope' (done) {
customTag_define('TestAsync', Compo.create({
onRenderStart () {
var x = this.$scope('X');
eq_(x, null, 'Scope should be empty, while still loading');
setTimeout(() => {
x = this.$scope('X');
has_(x, { foo: { name: 'Foo1' }});
done();
}, 300);
}
}));
renderer_render(`
import async * as X from '/test/tmpl/modules/data_foo_1.js';
TestAsync;
`);
},
'should await the component': {
'simple await' (done) {
customTag_define('TestAsync', Compo({
onRenderStart () {
var x = this.$scope('X');
has_(x, { foo: { name: 'Foo2' }});
done();
}
}));
renderer_render(`
import async * as X from '/test/tmpl/modules/data_foo_2.js';
await (X) > TestAsync;
`);
示例6: UTest
import { customTag_define } from '@core/custom/tag';
import { renderer_render } from '@core/renderer/exports';
import { Compo } from '@compo/exports';
declare var sinon;
UTest({
'should set elements property' () {
let div = renderer_render(`
div
[style.position] = relative
[style.borderTopWidth] = 2em
;
`);
eq_(div.style.position, 'relative');
eq_(div.style.borderTopWidth, '2em');
},
'should set components properties' () {
let fn = sinon.spy(function(model){
eq_(this.a.b.c, 'd');
});
customTag_define('Foo', Compo({
onRenderStart: fn
}))
renderer_render('Foo [a.b.c] = d');
eq_(fn.callCount, 1);
}
});
示例7: if
template: mix
}]));
}
}
else if (typeof mix === 'function') {
createNode(mix);
}
if (parent == null && container != null) {
parent = Anchor.resolveCompo(container);
}
if (parent == null){
parent = new Component();
}
var dom = renderer_render(node, model, ctx, null, parent),
instance = parent.components[parent.components.length - 1];
if (container != null){
container.appendChild(dom);
CompoSignals.signal.emitIn(instance, 'domInsert');
}
return instance;
},
find: compo_find,
findAll: compo_findAll,
closest: compo_closest,
示例8: deepEq_
deepEq_(node.extends, [
{ compo: 'a' },
{ compo: 'b' },
{ compo: 'c.y.z' },
]);
}
},
'should pass arguments as a model': {
'single' () {
var template = `
define Foo (user) {
h4 > '~user.name'
}
Foo (me);
`
var dom = renderer_render(template, { me: { name: 'TestUser' }});
return UTest.domtest(dom, `
find (h4) > text TestUser;
`)
},
'multiple' () {
var template = `
define Foo (user, friend) {
h3 > '~user.name'
h4 > '~friend.name'
}
Foo (me, me);
`
var dom = renderer_render(template, { me: { name: 'TestUser' }});
return UTest.domtest(dom, `
find (h3) > text TestUser;