當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Emitter.emit方法代碼示例

本文整理匯總了TypeScript中atom.Emitter.emit方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Emitter.emit方法的具體用法?TypeScript Emitter.emit怎麽用?TypeScript Emitter.emit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在atom.Emitter的用法示例。


在下文中一共展示了Emitter.emit方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: Map

 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: 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

示例3:

 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

示例4: destroy

 public destroy() {
   this.backend.destroy()
   this.emitter.emit('did-destroy')
   this.disposables.dispose()
 }
開發者ID:mvoidex,項目名稱:atom-haskell-hsdev,代碼行數:5,代碼來源:index.ts

示例5:

 backend.onWarning((arg) => this.emitter.emit('warning', arg)),
開發者ID:mvoidex,項目名稱:atom-haskell-hsdev,代碼行數:1,代碼來源:index.ts

示例6: debug

 this.proc.once('exit', (code) => {
   this.timer && window.clearTimeout(this.timer)
   debug(`hsdev ended with ${code}`)
   this.emitter.emit('did-exit', code)
   this.disposables.dispose()
 })
開發者ID:mvoidex,項目名稱:atom-haskell-hsdev,代碼行數:6,代碼來源:interactive-process.ts


注:本文中的atom.Emitter.emit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。