本文整理汇总了TypeScript中typings-core.Emitter类的典型用法代码示例。如果您正苦于以下问题:TypeScript Emitter类的具体用法?TypeScript Emitter怎么用?TypeScript Emitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Emitter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: EventEmitter
boolean: ['version', 'save', 'saveDev', 'savePeer', 'ambient', 'verbose', 'dev', 'production'],
string: ['cwd', 'out', 'name'],
alias: {
ambient: ['A'],
version: ['v'],
save: ['S'],
saveDev: ['save-dev', 'D'],
savePeer: ['savePeer', 'P'],
verbose: ['V'],
out: ['o'],
help: ['h']
}
})
const cwd = process.cwd()
const emitter: Emitter = new EventEmitter()
const isDev = IS_PRODUCTION ? argv.dev : !argv.production
const args: Args = extend({ cwd, emitter }, argv, { dev: isDev, production: !isDev })
// Notify the user of updates.
updateNotifier({ pkg }).notify()
// Execute with normalizations applied.
exec(args)
// Log warnings on enoent events.
emitter.on('enoent', function ({ path }) {
logWarning(`Path "${path}" is missing`, 'enoent')
})
// Log warning when typings come packaged.
开发者ID:CedarLogic,项目名称:typings,代码行数:31,代码来源:bin.ts
示例2: resolve
global: ['G'],
version: ['v'],
save: ['S'],
saveDev: ['save-dev', 'D'],
savePeer: ['savePeer', 'P'],
verbose: ['V'],
out: ['o'],
help: ['h']
},
default: {
production: process.env.NODE_ENV === 'production'
}
})
const cwd = argv.cwd ? resolve(argv.cwd) : process.cwd()
const emitter: Emitter = new EventEmitter()
const args: Args = extend(argv, { emitter, cwd })
// Notify the user of updates.
updateNotifier({ pkg }).notify()
// Execute with normalizations applied.
exec(args)
// Log warnings on enoent events.
emitter.on('enoent', function ({ path }) {
logWarning(`Path "${path}" is missing`, 'enoent')
})
// Log warning when typings come packaged.
emitter.on('hastypings', function ({ name, typings }) {
开发者ID:AndreiShostik,项目名称:typings,代码行数:31,代码来源:bin.ts
示例3: EventEmitter
boolean: ['version', 'save', 'saveDev', 'savePeer', 'ambient', 'verbose', 'dev', 'production'],
string: ['cwd', 'out', 'name'],
alias: {
ambient: ['A'],
version: ['v'],
save: ['S'],
saveDev: ['save-dev', 'D'],
savePeer: ['savePeer', 'P'],
verbose: ['V'],
out: ['o'],
help: ['h']
}
})
const cwd = process.cwd()
const emitter: Emitter = new EventEmitter()
const isDev = IS_PRODUCTION ? argv.dev : !argv.production
const args: Args = extend({ cwd, emitter }, argv, { dev: isDev, production: !isDev })
// Notify the user of updates.
updateNotifier({ pkg }).notify()
// Execute with normalizations applied.
exec(args)
// Log warnings on enoent events.
emitter.on('enoent', function ({ path }) {
logWarning(`Path "${path}" is missing`, 'ENOENT')
})
/**
开发者ID:SethDavenport,项目名称:typings,代码行数:31,代码来源:bin.ts
注:本文中的typings-core.Emitter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论