本文整理汇总了TypeScript中backburner.schedule函数的典型用法代码示例。如果您正苦于以下问题:TypeScript schedule函数的具体用法?TypeScript schedule怎么用?TypeScript schedule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了schedule函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
QUnit.test('schedule - DEBUG flag enables stack tagging', function(assert) {
let bb = new Backburner(['one']);
bb.schedule('one', () => {});
if (!bb.currentInstance) {
throw new Error('bb has no instance');
}
assert.ok(bb.currentInstance && !bb.currentInstance.queues.one.stackFor(0), 'No stack is recorded');
bb.DEBUG = true;
bb.schedule('one', () => {});
if (new Error().stack) { // workaround for CLI runner :(
assert.expect(4);
let stack = bb.currentInstance && bb.currentInstance.queues.one.stackFor(1);
assert.ok(typeof stack === 'string', 'A stack is recorded');
let onError = function(error, errorRecordedForStack) {
assert.ok(errorRecordedForStack, 'errorRecordedForStack passed to error function');
assert.ok(errorRecordedForStack.stack, 'stack is recorded');
};
bb = new Backburner(['errors'], { onError });
bb.DEBUG = true;
bb.run(() => {
bb.schedule('errors', () => {
throw new Error('message!');
});
});
}
});
开发者ID:ebryn,项目名称:backburner.js,代码行数:34,代码来源:debug-test.ts
示例2: resetError
bb.run(function() {
bb.schedule('one', target1, method, arg1);
bb.schedule('two', target2, method, arg1, arg2);
debugInfo = bb.getDebugInfo();
resetError();
assert.deepEqual(debugInfo.instanceStack,
[
{
one: [
{
args: [arg1],
method,
stack: oneStack,
target: target1
}
],
two: [
{
args: [arg1, arg2],
method,
stack: twoStack,
target: target2
}
]
}
]
, 'debugInfo is output');
});
开发者ID:ebryn,项目名称:backburner.js,代码行数:31,代码来源:debug-info-test.ts
示例3:
bb.run(() => {
bb.schedule('render', method);
bb.schedule('afterRender', method);
debugInfo = bb.currentInstance && bb.currentInstance._getDebugInfo(bb.DEBUG);
assert.deepEqual(debugInfo, {
render: [
{
target: null,
method,
args: undefined,
stack: renderStack
}
],
afterRender: [
{
target: null,
method,
args: undefined,
stack: afterRenderStack
}
]
});
});
开发者ID:ebryn,项目名称:backburner.js,代码行数:25,代码来源:defer-debug-info-test.ts
示例4: increment
function increment() {
if (++count < 3) {
bb.schedule('one', increment);
}
if (count === 3) {
bb.schedule('one', increment);
}
}
开发者ID:ebryn,项目名称:backburner.js,代码行数:10,代码来源:queue-test.ts
示例5:
bb.run(() => {
items.push(0);
bb.schedule('one', () => items.push(4));
bb.join(() => {
items.push(1);
bb.schedule('one', () => items.push(5));
items.push(2);
});
bb.schedule('one', () => items.push(6));
items.push(3);
});
开发者ID:ebryn,项目名称:backburner.js,代码行数:11,代码来源:join-test.ts
示例6: function
QUnit.test('customized flushing - precedence is rechecked upon each flush', function(assert) {
assert.step('start');
let deferredFlush;
let bb = new Backburner(
[
'zomg',
'render',
'afterRender'
],
{
flush(queueName, flush) {
if (deferredFlush === undefined && queueName === 'render') {
deferredFlush = flush;
} else {
flush();
}
}
}
);
bb.schedule('zomg', null, () => {
assert.step('running zomg');
});
bb.schedule('render', null, () => {
assert.step('running render');
});
bb.schedule('afterRender', null, () => {
assert.step('running afterRender');
});
return escapeCurrentMicrotaskQueue()
.then(() => {
bb.schedule('zomg', null, () => {
assert.step('running zomg 2');
});
deferredFlush();
})
.then(escapeCurrentMicrotaskQueue)
.then(() => {
assert.verifySteps([
'start',
'running zomg',
'running zomg 2',
'running render',
'running afterRender',
]);
});
});
开发者ID:ebryn,项目名称:backburner.js,代码行数:53,代码来源:autorun-test.ts
示例7: function
bb.run(function() {
assert.equal(step++, 0, '0');
bb.schedule('two', null, function() {
assert.equal(step++, 1, '1');
bb.schedule('one', null, function() {
assert.equal(step++, 3, '3');
});
});
bb.schedule('two', null, function() {
assert.equal(step++, 2, '2');
});
});
开发者ID:ebryn,项目名称:backburner.js,代码行数:15,代码来源:queue-test.ts
示例8:
return Promise.resolve().then(() => {
actual.push('third');
bb.schedule('actions', () => {
actual.push('action3');
});
});
开发者ID:ebryn,项目名称:backburner.js,代码行数:7,代码来源:autorun-test.ts
注:本文中的backburner.schedule函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论