本文整理汇总了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;未经允许,请勿转载。 |
请发表评论