本文整理汇总了TypeScript中jb-core.jb.delay方法的典型用法代码示例。如果您正苦于以下问题:TypeScript jb.delay方法的具体用法?TypeScript jb.delay怎么用?TypeScript jb.delay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jb-core.jb
的用法示例。
在下文中一共展示了jb.delay方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: message
export function message(message,error) {
$('.studio-message').text(message); // add animation
$('.studio-message').css('background', error ? 'red' : '#327DC8');
$('.studio-message').css('animation','');
jb.delay(1).then(()=>
$('.studio-message').css('animation','slide_from_top 5s ease')
)
}
示例2: paste
paste(ctx,close) {
var toPaste = this.toPaste + ((typeof this.value != 'object' || close) ? '%' : '/');
var suggestionCtx = ctx.vars.suggestionCtx;
var input = suggestionCtx.input;
var pos = this.pos + 1;
input.value = input.value.substr(0,this.pos-this.tail.length) + toPaste + input.value.substr(pos);
suggestionCtx.show = false;
suggestionCtx.selected = null;
return jb.delay(1,ctx).then (() => {
input.selectionStart = pos + toPaste.length;
input.selectionEnd = input.selectionStart;
})
}
示例3: modify
modify(op,path,args,ctx,delayed) {
var comp = path.split('~')[0];
var before = getComp(comp) && compAsStr(comp);
var res = op.call(this,path,args);
if (res && res.newPath) // used for insert to array that creates new path
path = res.newPath;
jb.delay(delayed?1:0).then(()=>{
modifyOperationsEm.next({
comp: comp,
before: before,
after: compAsStr(comp),
path: path,
args: args,
ctx: ctx,
// jbart: findjBartToLook(path),
newComp: before ? false: true
})
})
}
示例4: function
afterViewInit: function(cmp) {
var suggestionCtx = ctx.vars.suggestionCtx;
jb.delay(1,ctx).then(()=>{// ctx.vars.ngZone.runOutsideAngular(() => {
var keyEm = suggestionCtx.keyEm;
keyEm.filter(e=>
e.keyCode == 13) // ENTER
.subscribe(()=>{
suggestionCtx.show = false;
if (suggestionCtx.selected && suggestionCtx.selected.paste) {
suggestionCtx.selected.paste(ctx);
suggestionCtx.selected = null;
}
jb_ui.apply(ctx);
})
keyEm.filter(e=>e.keyCode == 27) // ESC
.subscribe(x=>
suggestionCtx.show = false)
keyEm.filter(e=>
e.keyCode == 38 || e.keyCode == 40)
.subscribe(e=>{
var diff = e.keyCode == 40 ? 1 : -1;
var items = cmp.items; //.filter(item=>!item.heing);
var newIndex = (items.indexOf(suggestionCtx.selected) + diff + items.length) % items.length;
cmp.selected = suggestionCtx.selected = items[newIndex];
jb_logPerformance('suggestions',newIndex,suggestionCtx.selected);
suggestionCtx.refresh();
e.preventDefault();
})
suggestionCtx.suggestionEm.subscribe(e=> {
suggestionCtx.show = e.options.length > 0;
suggestionCtx.options = e.options;
suggestionCtx.selected = e.options[0];
suggestionCtx.refresh();
})
})
},
示例5: resolve
.subscribe(x=>{
if (!forTests)
jb.delay(1,ctx).then(()=>dialog.close()); // delay to avoid race conditin with itself
// console.log('close test dialog',ctx.id);
resolve({ element : cmp.elementRef.nativeElement });
})