事件:'history'
添加于:v15.8.0、v14.18.0
每当历史数组发生更改时,都会发出 'history'
事件。
使用包含历史数组的数组调用侦听器函数。它将反映由于 historySize
和 removeHistoryDuplicates
引起的所有更改、添加的行和删除的行。
主要目的是允许侦听器保留历史记录。侦听器也可以更改历史对象。这对于防止将某些行添加到历史记录中可能很有用,例如密码。
rl.on('history', (history) => {
console.log(`Received: ${history}`);
});
相关用法
- Node.js ClientHttp2Stream 'headers'事件用法及代码示例
- Node.js tls.Server 'keylog'事件用法及代码示例
- Node.js http.Server 'clientError'事件用法及代码示例
- Node.js cluste 'disconnect'事件用法及代码示例
- Node.js proces 'exit'事件用法及代码示例
- Node.js stream.Writable 'pipe'事件用法及代码示例
- Node.js stream.Readable 'end'事件用法及代码示例
- Node.js cluste 'fork'事件用法及代码示例
- Node.js stream.Writable 'unpipe'事件用法及代码示例
- Node.js Http2Session 'remoteSettings'事件用法及代码示例
- Node.js Worker 'listening'事件用法及代码示例
- Node.js tls.Server 'resumeSession'事件用法及代码示例
- Node.js InterfaceConstructor 'pause'事件用法及代码示例
- Node.js fs.FSWatcher 'change'事件用法及代码示例
- Node.js stream.Readable 'data'事件用法及代码示例
- Node.js http.ClientRequest 'connect'事件用法及代码示例
- Node.js proces 'uncaughtException'事件用法及代码示例
- Node.js Http2Session 'localSettings'事件用法及代码示例
- Node.js REPLServer 'exit'事件用法及代码示例
- Node.js cluste 'online'事件用法及代码示例
- Node.js tls.TLSSocket 'session'事件用法及代码示例
- Node.js Worker 'exit'事件用法及代码示例
- Node.js cluste 'exit'事件用法及代码示例
- Node.js Http2Stream 'trailers'事件用法及代码示例
- Node.js MessagePort 'close'事件用法及代码示例
注:本文由纯净天空筛选整理自nodejs.org大神的英文原创作品 'history'事件。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。