diff options
author | Sam Potts <sam@potts.es> | 2020-03-29 12:02:59 +1100 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2020-03-29 12:02:59 +1100 |
commit | 09598f07bf062886bfa22cd8682948567e92a19a (patch) | |
tree | 2ed0de186d43b2cc27422115fe75600a12e5d303 /src/js/utils/promise.js | |
parent | ef7b30c1b8a0e2d9a8cb71dfb41af0706bb8886e (diff) | |
parent | 155add66bd5b941699cea99f5c94cf8a87b030d8 (diff) | |
download | plyr-09598f07bf062886bfa22cd8682948567e92a19a.tar.lz plyr-09598f07bf062886bfa22cd8682948567e92a19a.tar.xz plyr-09598f07bf062886bfa22cd8682948567e92a19a.zip |
Merge branch 'develop' of github.com:sampotts/plyr into develop
# Conflicts:
# package.json
# yarn.lock
Diffstat (limited to 'src/js/utils/promise.js')
-rw-r--r-- | src/js/utils/promise.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/js/utils/promise.js b/src/js/utils/promise.js new file mode 100644 index 00000000..f45b46ab --- /dev/null +++ b/src/js/utils/promise.js @@ -0,0 +1,14 @@ +import is from './is'; +/** + * 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 (is.promise(value)) { + value.then(null, () => {}); + } +} + +export default { silencePromise }; |