本文整理汇总了TypeScript中jb-core.jb.entries方法的典型用法代码示例。如果您正苦于以下问题:TypeScript jb.entries方法的具体用法?TypeScript jb.entries怎么用?TypeScript jb.entries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jb-core.jb
的用法示例。
在下文中一共展示了jb.entries方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: compAsStr
impl : (ctx,force) =>
jb_rx.Observable.from(jb.entries(modified))
.filter(x=>x)
.concatMap(toSave=>{
var comp = toSave[0], val = toSave[1];
message('saving ' + comp);
if (force && !val.original)
val.original = `jb.component('${comp}', {`;
return $.ajax({
url: `/?op=saveComp&comp=${comp}&project=${ctx.exp('%$globals/project%')}&force=${force}`,
type: 'POST',
data: JSON.stringify({ original: val && val.original, toSave: compAsStr(comp) }),
headers: { 'Content-Type': 'application/json; charset=UTF-8' }
}).then(
res=>({ res: res , comp: comp }),
e=> { throw { e: e , comp: comp } }
)
// return fetch(`/?op=saveComp&comp=${comp}&project=${ctx.exp('%$globals/project%')}&force=${force}`, {
// method: 'post',
// body: JSON.stringify({ original: val && val.original, toSave: compAsStr(comp) }),
// headers: { 'Content-type': 'application/json; charset=UTF-8' },
// })
})
.catch(e=>{
message('error saving: ' + e.e);
jb.logException(e,'error while saving ' + e.comp)
})
.subscribe(entry=>{
var result = entry.res;
message((result.type || '') + ': ' + (result.desc || '') + (result.message || ''), result.type != 'success');
if (result.type == 'success')
delete modified[entry.comp];
})
示例2: extendWithOptions
extendWithOptions(probeCtx,path) {
this.options = [];
probeCtx = probeCtx || (jbart.previewjbart || jbart).initialCtx;
var vars = jb.entries(jb.extend({},(probeCtx.componentContext||{}).params,probeCtx.vars,probeCtx.resources))
.map(x=>new ValueOption('$'+x[0],x[1],this.pos,this.tail))
.filter(x=> x.toPaste.indexOf('$$') != 0)
.filter(x=>['$ngZone','$window','$injector'].indexOf(x.toPaste) == -1)
if (this.inputVal.indexOf('=') == 0 && !this.expressionOnly)
this.options = model.PTsOfPath(path).map(compName=> {
var name = compName.substring(compName.indexOf('.')+1);
var ns = compName.substring(0,compName.indexOf('.'));
return new CompOption(compName, compName, ns ? `${name} (${ns})` : name, getComp(compName).description || '')
})
else if (this.tailSymbol == '%')
this.options = [].concat.apply([],jb.toarray(probeCtx.exp('%%'))
.map(x=>
jb.entries(x).map(x=> new ValueOption(x[0],x[1],this.pos,this.tail))))
.concat(vars)
else if (this.tailSymbol == '%$')
this.options = vars
else if (this.tailSymbol == '/' || this.tailSymbol == '.')
this.options = [].concat.apply([],
jb.toarray(probeCtx.exp(this.base))
.map(x=>jb.entries(x).map(x=>new ValueOption(x[0],x[1],this.pos,this.tail))) )
this.options = this.options
.filter( jb_unique(x=>x.toPaste) )
.filter(x=> x.toPaste != this.tail)
.filter(x=>
this.tail == '' || typeof x.toPaste != 'string' || (x.description + x.toPaste).toLowerCase().indexOf(this.tail.toLowerCase()) != -1)
if (this.tail)
this.options.sort((x,y)=> (y.toPaste.toLowerCase().indexOf(this.tail.toLowerCase()) == 0 ? 1 : 0) - (x.toPaste.toLowerCase().indexOf(this.tail.toLowerCase()) == 0 ? 1 : 0));
this.key = this.options.map(o=>o.toPaste).join(',');
return this;
}
示例3:
impl: (context,project) => {
if (!project) return;
var comps = jb.entries(jbart_base().comps).map(x=>x[0]).filter(x=>x.indexOf(project) == 0);
return comps.map(comp=>compAsStr(comp)).join('\n\n')
}
示例4: ValueOption
.map(x=>jb.entries(x).map(x=>new ValueOption(x[0],x[1],this.pos,this.tail))) )