aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/utils/promise.js
diff options
context:
space:
mode:
authorDanielh112 <Daniel@sbgsportssoftware.com>2020-08-18 11:29:25 +0100
committerDanielh112 <Daniel@sbgsportssoftware.com>2020-08-18 11:29:25 +0100
commitf7e9ee56d2ed5447f59e5548f005fabdab2f0a72 (patch)
treea16300fa62e68b3310ae96e36dba65981f0024ef /src/js/utils/promise.js
parent22af7f16ea4a4269321d29242d63ec23718c92da (diff)
parent423b7b276f1572eb666de32094a9aacd32e87d18 (diff)
downloadplyr-f7e9ee56d2ed5447f59e5548f005fabdab2f0a72.tar.lz
plyr-f7e9ee56d2ed5447f59e5548f005fabdab2f0a72.tar.xz
plyr-f7e9ee56d2ed5447f59e5548f005fabdab2f0a72.zip
Fix merge conflicts
Diffstat (limited to 'src/js/utils/promise.js')
-rw-r--r--src/js/utils/promise.js14
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..4b59bba3
--- /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 };