chore: augment promisifyMultiArg deprecation (#17066)

This commit is contained in:
Shelley Vohr 2019-02-26 02:25:25 +00:00 коммит произвёл Samuel Attard
Родитель 7a7389ab1c
Коммит d9c7735a04
3 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -5,6 +5,9 @@ const contentTracing = process.atomBinding('content_tracing')
contentTracing.getCategories = deprecate.promisify(contentTracing.getCategories)
contentTracing.startRecording = deprecate.promisify(contentTracing.startRecording)
contentTracing.stopRecording = deprecate.promisify(contentTracing.stopRecording)
contentTracing.getTraceBufferUsage = deprecate.promisifyMultiArg(contentTracing.getTraceBufferUsage)
contentTracing.getTraceBufferUsage = deprecate.promisifyMultiArg(
contentTracing.getTraceBufferUsage,
(value) => [value.paths, value.bookmarks]
)
module.exports = contentTracing

Просмотреть файл

@ -102,7 +102,7 @@ const deprecate: ElectronInternal.DeprecationUtil = {
} as T
},
promisifyMultiArg: <T extends (...args: any[]) => any>(fn: T): T => {
promisifyMultiArg: <T extends (...args: any[]) => any>(fn: T, convertPromiseValue: (v: any) => any): T => {
const fnName = fn.name || 'function'
const oldName = `${fnName} with callbacks`
const newName = `${fnName} with Promises`

2
typings/internal-electron.d.ts поставляемый
Просмотреть файл

@ -66,7 +66,7 @@ declare namespace ElectronInternal {
renameProperty<T, K extends (keyof T & string)>(object: T, oldName: string, newName: K): T;
promisify<T extends (...args: any[]) => any>(fn: T): T;
promisifyMultiArg<T extends (...args: any[]) => any>(fn: T): T;
promisifyMultiArg<T extends (...args: any[]) => any>(fn: T, convertPromiseValue: (v: any) => any): T;
}
// Internal IPC has _replyInternal and NO reply method