本文整理汇总了TypeScript中event-kit.Emitter.emit方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Emitter.emit方法的具体用法?TypeScript Emitter.emit怎么用?TypeScript Emitter.emit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event-kit.Emitter
的用法示例。
在下文中一共展示了Emitter.emit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setName
setName(name: string) {
if (name !== this.name) {
this.name = name;
this.emitter.emit("did-change-name", name);
}
return name;
}
示例2: setName
setName(name: string): void {
if (this.name != name) {
this.name = name;
this.emitter.emit('did-change-name', name);
}
}
示例3: dispose
{ dispose() {} }
);
subscriptions.remove(subscription);
subscriptions.remove({ dispose() {} });
subscriptions.delete(subscription);
subscriptions.delete({ dispose() {} });
subscriptions.clear();
// Emitter ====================================================================
bool = emitter.disposed;
emitter.clear();
emitter.dispose();
// Event Subscription
subscription = emitter.on("test-event", value => {});
emitter.once("test-event", value => {});
subscription = emitter.preempt("test-event", value => {});
// Event Emission
emitter.emit("test-event");
emitter.emit("test-event", 42);
async function testEmitAsync() {
await emitter.emitAsync("test-event");
await emitter.emitAsync("test-event", 42);
}