mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
This reverts commit 556d230a0e.
Reason for revert: Breaks the build on windows.
Original change's description:
> Update esbuild
>
> DISABLE_THIRD_PARTY_CHECK=DEPS needs to be updated together
>
> Bug: none
> Change-Id: I6af5660c313d5d998b320f688a36a1f3de5beb03
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5025093
> Commit-Queue: Randolf Jung <jrandolf@chromium.org>
> Reviewed-by: Danil Somsikov <dsv@chromium.org>
Bug: none
Change-Id: I331613611d0b8bd56a96a5eff50e452213f6f14b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5033272
Reviewed-by: Danil Somsikov <dsv@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Danil Somsikov <dsv@chromium.org>
Auto-Submit: Philip Pfaffe <pfaffe@chromium.org>
25 lines
712 B
JavaScript
25 lines
712 B
JavaScript
'use strict'
|
|
|
|
exports.fromCallback = function (fn) {
|
|
return Object.defineProperty(function (...args) {
|
|
if (typeof args[args.length - 1] === 'function') fn.apply(this, args)
|
|
else {
|
|
return new Promise((resolve, reject) => {
|
|
fn.call(
|
|
this,
|
|
...args,
|
|
(err, res) => (err != null) ? reject(err) : resolve(res)
|
|
)
|
|
})
|
|
}
|
|
}, 'name', { value: fn.name })
|
|
}
|
|
|
|
exports.fromPromise = function (fn) {
|
|
return Object.defineProperty(function (...args) {
|
|
const cb = args[args.length - 1]
|
|
if (typeof cb !== 'function') return fn.apply(this, args)
|
|
else fn.apply(this, args.slice(0, -1)).then(r => cb(null, r), cb)
|
|
}, 'name', { value: fn.name })
|
|
}
|