本文整理汇总了TypeScript中atom.Emitter类的典型用法代码示例。如果您正苦于以下问题:TypeScript Emitter类的具体用法?TypeScript Emitter怎么用?TypeScript Emitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Emitter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: Error
public addParamSpec<T>(
pluginName: string,
paramName: string,
spec: UPI.IParamSpec<T>,
) {
let pluginConfig = this.plugins.get(pluginName)
if (!pluginConfig) {
pluginConfig = new Map()
this.plugins.set(pluginName, pluginConfig)
}
if (pluginConfig.has(paramName)) {
throw new Error(`Parameter ${pluginName}.${paramName} already defined!`)
}
let value: T | undefined = this.saved[`${pluginName}.${paramName}`] as T
if (value === undefined) {
value = spec.default
}
pluginConfig.set(paramName, { spec, value })
this.emitter.emit('did-update', { pluginName, paramName, value })
return new Disposable(() => {
if (pluginConfig) {
pluginConfig.delete(paramName)
if (pluginConfig.size === 0) {
this.plugins.delete(pluginName)
}
}
})
}
开发者ID:atom-haskell,项目名称:ide-haskell,代码行数:28,代码来源:param-store.ts
示例2: callback
public onDidUpdate<T>(
pluginName: string,
paramName: string,
callback: TUpdatedCallback<T>,
) {
return this.emitter.on('did-update', (val) => {
if (val.pluginName === pluginName && val.paramName === paramName) {
callback(val)
}
})
}
开发者ID:atom-haskell,项目名称:ide-haskell,代码行数:11,代码来源:param-store.ts
示例3: didUpdate
public didUpdate(providerId: number, msgs: ResultItem[]) {
const uris: string[] = msgs.map((v) => v.uri).filter(notUndefined)
for (const [k, v] of Array.from(this.messages)) {
if (
v.providerId === providerId ||
(v.uri !== undefined && uris.includes(v.uri))
) {
this.messages.delete(k)
}
}
for (const msg of msgs) {
this.messages.set(msg.hash(), msg)
}
const severities: Set<UPI.TSeverity> = new Set(msgs.map((v) => v.severity))
this.emitter.emit('did-update', Array.from(severities))
}
开发者ID:atom-haskell,项目名称:ide-haskell,代码行数:16,代码来源:index.ts
示例4:
public async setValue<T>(
pluginName: string,
paramName: string,
value?: T,
): Promise<T | undefined> {
const paramConfig = await this.getParamConfig<T>(
pluginName,
paramName,
'set',
)
if (paramConfig === undefined) return undefined
if (value === undefined) {
value = await this.showSelect<T>(paramConfig)
}
if (value !== undefined) {
paramConfig.value = value
this.saved[`${pluginName}.${paramName}`] = value
this.emitter.emit('did-update', { pluginName, paramName, value })
}
return value
}
开发者ID:atom-haskell,项目名称:ide-haskell,代码行数:21,代码来源:param-store.ts
示例5: onDidUpdate
public onDidUpdate(callback: TUpdateCallback) {
return this.emitter.on('did-update', callback)
}
开发者ID:atom-haskell,项目名称:ide-haskell,代码行数:3,代码来源:index.ts
示例6: onQueueIdle
public onQueueIdle(callback: () => void) {
return this.emitter.on('queue-idle', callback)
}
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:3,代码来源:index.ts
示例7: onBackendIdle
public onBackendIdle(callback: () => void) {
return this.emitter.on('backend-idle', callback)
}
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:3,代码来源:index.ts
示例8: onBackendActive
public onBackendActive(callback: () => void) {
return this.emitter.on('backend-active', callback)
}
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:3,代码来源:index.ts
示例9: onError
public onError(callback: (error: IErrorCallbackArgs) => void) {
return this.emitter.on('error', callback)
}
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:3,代码来源:index.ts
示例10: onWarning
public onWarning(callback: (warning: string) => void) {
return this.emitter.on('warning', callback)
}
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:3,代码来源:index.ts
注:本文中的atom.Emitter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论