aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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) {