aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/storage.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2018-06-13 00:02:55 +1000
committerSam Potts <sam@potts.es>2018-06-13 00:02:55 +1000
commit392dfd024c505f5ae1bbb2f0d3e0793c251a1f35 (patch)
treeaedb56d3945eaa10bf74e61902e16c08fd24914a /src/js/storage.js
parent840e31a693462e7ed9f7644a13a0187d9e9d93a9 (diff)
downloadplyr-392dfd024c505f5ae1bbb2f0d3e0793c251a1f35.tar.lz
plyr-392dfd024c505f5ae1bbb2f0d3e0793c251a1f35.tar.xz
plyr-392dfd024c505f5ae1bbb2f0d3e0793c251a1f35.zip
Utils broken down into seperate files and exports
Diffstat (limited to 'src/js/storage.js')
-rw-r--r--src/js/storage.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/js/storage.js b/src/js/storage.js
index e4dc9e1b..27fdad9f 100644
--- a/src/js/storage.js
+++ b/src/js/storage.js
@@ -2,7 +2,8 @@
// Plyr storage
// ==========================================================================
-import utils from './utils';
+import is from './utils/is';
+import { extend } from './utils/objects';
class Storage {
constructor(player) {
@@ -37,13 +38,13 @@ class Storage {
const store = window.localStorage.getItem(this.key);
- if (utils.is.empty(store)) {
+ if (is.empty(store)) {
return null;
}
const json = JSON.parse(store);
- return utils.is.string(key) && key.length ? json[key] : json;
+ return is.string(key) && key.length ? json[key] : json;
}
set(object) {
@@ -53,7 +54,7 @@ class Storage {
}
// Can only store objectst
- if (!utils.is.object(object)) {
+ if (!is.object(object)) {
return;
}
@@ -61,12 +62,12 @@ class Storage {
let storage = this.get();
// Default to empty object
- if (utils.is.empty(storage)) {
+ if (is.empty(storage)) {
storage = {};
}
// Update the working copy of the values
- utils.extend(storage, object);
+ extend(storage, object);
// Update storage
window.localStorage.setItem(this.key, JSON.stringify(storage));