本文整理汇总了TypeScript中vs/base/common/eventEmitter.OrderGuaranteeEventEmitter类的典型用法代码示例。如果您正苦于以下问题:TypeScript OrderGuaranteeEventEmitter类的具体用法?TypeScript OrderGuaranteeEventEmitter怎么用?TypeScript OrderGuaranteeEventEmitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OrderGuaranteeEventEmitter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('OrderGuaranteeEventEmitter makes order guarantees 2', () => {
var emitter = new OrderGuaranteeEventEmitter();
var actualCallOrder: string[] = [];
emitter.addListener('foo', function() {
actualCallOrder.push('listener1-foo');
emitter.deferredEmit(() => {
emitter.emit('bar')
})
});
emitter.addListener('foo', function() {
actualCallOrder.push('listener2-foo');
})
emitter.addListener('bar', function() {
actualCallOrder.push('listener2-bar');
})
emitter.deferredEmit(() => {
emitter.emit('foo');
});
assert.deepEqual(actualCallOrder, [
'listener1-foo',
'listener2-foo',
'listener2-bar'
]);
});
示例2: test
test('OrderGuaranteeEventEmitter makes order guarantees 1', () => {
let emitter = new OrderGuaranteeEventEmitter();
let actualCallOrder: string[] = [];
emitter.addListener2('foo', function () {
actualCallOrder.push('listener1-foo');
emitter.emit('bar');
});
emitter.addListener2('foo', function () {
actualCallOrder.push('listener2-foo');
});
emitter.addListener2('bar', function () {
actualCallOrder.push('listener2-bar');
});
emitter.emit('foo');
assert.deepEqual(actualCallOrder, [
'listener1-foo',
'listener2-foo',
'listener2-bar'
]);
});
示例3:
emitter.deferredEmit(() => {
emitter.emit('foo');
});
示例4: function
emitter.addListener('foo', function() {
actualCallOrder.push('listener1-foo');
emitter.deferredEmit(() => {
emitter.emit('bar')
})
});
示例5: function
emitter.addListener2('foo', function () {
actualCallOrder.push('listener1-foo');
emitter.emit('bar');
});