本文整理汇总了TypeScript中vscode.EventEmitter类的典型用法代码示例。如果您正苦于以下问题:TypeScript EventEmitter类的具体用法?TypeScript EventEmitter怎么用?TypeScript EventEmitter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventEmitter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: generateTranslationSchema
const update = async () => {
try {
await generateTranslationSchema({ rootPath: srcPath, filter: filter, schemaPath: schema, logger: logger, indention: indention, preprocessor: preprocessor, babylonConfig: babylonConfig })
spin(false)
var items = (oldSchema) ? ['Show Diff'] : ['Show File']
const value = await vscode.window.showInformationMessage('i18n json schema has been updated', ...items)
if (value === 'Show Diff') {
const oldUri = vscode.Uri.parse('i18n-schema:old.json')
const newUri = vscode.Uri.parse(`i18n-schema:${path.basename(schema)}`)
emitter.fire(oldUri)
emitter.fire(newUri)
vscode.commands.executeCommand('vscode.diff', oldUri, newUri)
}
if (value === 'Show File') {
try {
const file = await vscode.workspace.openTextDocument(schema)
vscode.window.showTextDocument(file)
} catch(err) {
vscode.window.showErrorMessage(err.message)
}
}
} catch (err) {
outputChannel.append(err)
vscode.window.showErrorMessage(err.message)
spin(false)
}
}
示例2: readConfig
readConfig().then(() => {
if (oldSchema) {
const oldUri = vscode.Uri.parse('i18n-schema:old.json')
const newUri = vscode.Uri.parse(`i18n-schema:${path.basename(schema)}`)
emitter.fire(oldUri)
emitter.fire(newUri)
vscode.commands.executeCommand('vscode.diff', oldUri, newUri)
} else {
vscode.window.showInformationMessage(`Schema has no local changes`)
}
resolve()
}, reject)