aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlbin Larsson <mail@albinlarsson.com>2018-05-14 06:49:04 +0200
committerAlbin Larsson <mail@albinlarsson.com>2018-05-14 06:49:04 +0200
commit7ca21697907850790f875d01bf27870a0386527b (patch)
tree647ad6234f0f25d8a42c1f5a05654efc283e562e /src
parent765c01e83dc4173d778538061a82e1973a8574f0 (diff)
downloadplyr-7ca21697907850790f875d01bf27870a0386527b.tar.lz
plyr-7ca21697907850790f875d01bf27870a0386527b.tar.xz
plyr-7ca21697907850790f875d01bf27870a0386527b.zip
Expose defaults (enable overriding)
Diffstat (limited to 'src')
-rw-r--r--src/js/plyr.js3
-rw-r--r--src/js/utils.js5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 6a3deade..bed09827 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -55,6 +55,7 @@ class Plyr {
this.config = utils.extend(
{},
defaults,
+ Plyr.defaults,
options || {},
(() => {
try {
@@ -1269,4 +1270,6 @@ class Plyr {
}
}
+Plyr.defaults = utils.cloneDeep(defaults);
+
export default Plyr;
diff --git a/src/js/utils.js b/src/js/utils.js
index ebfb9c96..5c4934a1 100644
--- a/src/js/utils.js
+++ b/src/js/utils.js
@@ -703,6 +703,11 @@ const utils = {
return array.filter((item, index) => array.indexOf(item) === index);
},
+ // Clone nested objects
+ cloneDeep(object) {
+ return JSON.parse(JSON.stringify(object));
+ },
+
// Get the closest value in an array
closest(array, value) {
if (!utils.is.array(array) || !array.length) {