Expose defaults (enable overriding)

This commit is contained in:
Albin Larsson 2018-05-14 06:49:04 +02:00
parent 765c01e83d
commit 7ca2169790
2 changed files with 8 additions and 0 deletions

View File

@ -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;

View File

@ -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) {