diff options
Diffstat (limited to 'javascript/videojs/src/js/utils/promise.js')
| -rw-r--r-- | javascript/videojs/src/js/utils/promise.js | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/javascript/videojs/src/js/utils/promise.js b/javascript/videojs/src/js/utils/promise.js deleted file mode 100644 index d488356..0000000 --- a/javascript/videojs/src/js/utils/promise.js +++ /dev/null @@ -1,28 +0,0 @@ - -/** - * Returns whether an object is `Promise`-like (i.e. has a `then` method). - * - * @param {Object} value - * An object that may or may not be `Promise`-like. - * - * @return {boolean} - * Whether or not the object is `Promise`-like. - */ -export function isPromise(value) { - return value !== undefined && value !== null && typeof value.then === 'function'; -} - -/** - * Silence a Promise-like object. - * - * This is useful for avoiding non-harmful, but potentially confusing "uncaught - * play promise" rejection error messages. - * - * @param {Object} value - * An object that may or may not be `Promise`-like. - */ -export function silencePromise(value) { - if (isPromise(value)) { - value.then(null, (e) => {}); - } -} |
