add store singleton

This commit is contained in:
igoradamenko
2018-02-02 20:52:27 +02:00
parent 7bf29b99dc
commit cb293c78fc
+26
View File
@@ -0,0 +1,26 @@
let _instance;
class Store {
constructor() {
if (_instance) return _instance;
this.data = {};
_instance = this;
return _instance;
}
set(obj) {
this.data = {
...this.data,
...obj,
};
}
get(key) {
return this.data[key];
}
}
export default new Store();