• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript atom.CompositeDisposable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中atom.CompositeDisposable的典型用法代码示例。如果您正苦于以下问题:TypeScript CompositeDisposable类的具体用法?TypeScript CompositeDisposable怎么用?TypeScript CompositeDisposable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CompositeDisposable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: registerCommands

export function registerCommands(deps: Dependencies) {
  const disp = new CompositeDisposable()
  for (const {selector, command, desc} of getCommands()) {
    disp.add(atom.commands.add(selector, command, desc(deps)))
  }
  return disp
}
开发者ID:patrickemuller,项目名称:atom-settings,代码行数:7,代码来源:index.ts


示例2: registerEvent

function registerEvent(
  name: string,
  manager: PluginManager,
  provider: Provider | undefined,
  cb: UPI.TSingleOrArray<UPI.TTextBufferCallback>,
  reg: (cb: UPI.TTextBufferCallback) => Disposable,
) {
  function wrapStatus(cb: UPI.TTextBufferCallback) {
    return async function(buffer: TextBuffer) {
      try {
        manager.backendStatus(name, { status: 'progress', detail: '' })
        const res = await cb(buffer)
        if (provider && Array.isArray(res)) provider.setMessages(res)
        manager.backendStatus(name, { status: 'ready', detail: '' })
      } catch (e) {
        manager.backendStatus(name, { status: 'warning', detail: `${e}` })
        console.warn(e)
      }
    }
  }
  if (Array.isArray(cb)) {
    const disp = new CompositeDisposable()
    for (const i of cb) {
      disp.add(reg(wrapStatus(i)))
    }
    return disp
  } else {
    return reg(wrapStatus(cb))
  }
}
开发者ID:atom-haskell,项目名称:ide-haskell,代码行数:30,代码来源:index.ts


示例3: registerCommands

export function registerCommands(deps: Dependencies): DisposableLike {
  const disp = new CompositeDisposable()
  for (const cmd of getCommands()) {
    if (cmd.selector === "atom-text-editor") {
      const d = cmd.desc(deps)
      disp.add(
        atom.commands.add(cmd.selector, cmd.command, {
          ...d,
          async didDispatch(e) {
            try {
              const editor = e.currentTarget.getModel()
              if (isTypescriptEditorWithPath(editor)) {
                await d.didDispatch(editor, () => e.abortKeyBinding())
              } else {
                e.abortKeyBinding()
                if (isTypescriptGrammar(editor)) {
                  atom.notifications.addWarning(
                    "Atom-TypeScript cancelled last command: Current editor has no file path",
                    {
                      description:
                        "Atom-TypeScript needs to determine the file path of the " +
                        `current editor to execute \`${cmd.command}\`, which it failed to do. ` +
                        "You probably just need to save the current file somewhere.",
                      dismissable: true,
                    },
                  )
                }
              }
            } catch (error) {
              handle(error as Error)
            }
          },
        }),
      )
    } else {
      const d = cmd.desc(deps)
      disp.add(
        atom.commands.add(cmd.selector, cmd.command, {
          ...d,
          async didDispatch() {
            try {
              await d.didDispatch()
            } catch (error) {
              handle(error as Error)
            }
          },
        }),
      )
    }
  }
  return disp
}
开发者ID:TypeStrong,项目名称:atom-typescript,代码行数:52,代码来源:index.ts


示例4: constructor

 constructor() {
   this.currentId = 0
   this.disposables = new CompositeDisposable()
   this.emitter = new Emitter()
   this.disposables.add(this.emitter)
   this.messages = new Map()
 }
开发者ID:atom-haskell,项目名称:ide-haskell,代码行数:7,代码来源:index.ts


示例5: constructor

 constructor(private upiPromise: Promise<UPI.IUPIInstance>) {
   this.disposables = new CompositeDisposable()
   this.emitter = new Emitter()
   this.disposables.add(this.emitter)
   this.bufferDirMap = new WeakMap()
   this.backend = this.startBackend()
 }
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:7,代码来源:index.ts


示例6: constructor

 constructor(state: IState = {}) {
   this.disposables = new CompositeDisposable()
   this.emitter = new Emitter()
   this.disposables.add(this.emitter)
   this.saved = state
   this.plugins = new Map()
 }
开发者ID:atom-haskell,项目名称:ide-haskell,代码行数:7,代码来源:param-store.ts


示例7:

            .then(() => {
                subscriptions.add(atom.commands.add('atom-workspace', {
                    'api-workbench:popular-apis': apiList.showPopularApis,
                    'api-workbench:editor-tools':editorTools.initEditorTools,
                    'api-workbench:console': Console.toggle,
                    'api-workbench:go-to-definition':decl.gotoDeclaration,
                    'api-workbench:find-usages':decl.findUsages,
                    'api-workbench:quick-outline':quickOutline.show,
                    'api-workbench:quick-commands': quickCommands.showCommands,
                    'api-workbench:rename':decl.renameRAMLElement,
                    'api-workbench:new-project':decl.newProject,
                    'api-workbench:select-node':decl.select
                }))

                subscriptions.add(atom.workspace.addOpener(Console.opener))
                //subscriptions.add(atom.workspace.addOpener(RamlScriptReport.opener))

                commandManager.initialize()
                contextMenu.initialize()
                commonContextActions.initialize()

                quickCommands.registerCommands()
                quickFixActions.initialize()

                editorTools.initEditorTools()
            })
开发者ID:andjarnic,项目名称:api-workbench,代码行数:26,代码来源:main.ts


示例8: consumeUPI

export function consumeUPI(service: UPI.IUPIRegistration) {
  if (!process || !disposables) { return undefined }
  tempDisposables && tempDisposables.dispose()
  tempDisposables = undefined
  const upiConsumer = new UPIConsumer(service, process)
  resolveUpiPromise(upiConsumer.upi)
  disposables.add(upiConsumer)
  return upiConsumer
}
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:9,代码来源:atom-haskell-hsdev.ts


示例9: deactivate

export function deactivate() {
  process && process.destroy()
  process = undefined
  completionBackend = undefined
  disposables && disposables.dispose()
  disposables = undefined
  tempDisposables = undefined
}
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:8,代码来源:atom-haskell-hsdev.ts


示例10: createBackend

 private async createBackend(): Promise<HsDevProcessReal> {
   const backend = await createHsDevProcessReal()
   this.disposables.add(
     backend.onError((arg) => this.emitter.emit('error', arg)),
     backend.onWarning((arg) => this.emitter.emit('warning', arg)),
   )
   return backend
 }
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:8,代码来源:index.ts



注:本文中的atom.CompositeDisposable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript atom.DisplayMarkerLayer类代码示例发布时间:2022-05-25
下一篇:
TypeScript atma-utils.class_Uri类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap