diff --git a/doc/api/util.md b/doc/api/util.md index 151e4769930280..2c0062eff7b62f 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -995,11 +995,32 @@ throw an error. ### `util.promisify.custom` * {symbol} that can be used to declare custom promisified variants of functions, see [Custom promisified functions][]. +In addition to being accessible through `util.promisify.custom`, this +symbol is [registered globally][global symbol registry] and can be +accessed in any environment as `Symbol.for('nodejs.util.promisify.custom')`. + +For example, with a function that takes in +`(foo, onSuccessCallback, onErrorCallback)`: + +```js +const kCustomPromisifiedSymbol = Symbol.for('nodejs.util.promisify.custom'); + +doSomething[kCustomPromisifiedSymbol] = (foo) => { + return new Promise((resolve, reject) => { + doSomething(foo, resolve, reject); + }); +}; +``` + ## Class: `util.TextDecoder`