2018-08-05 18:19:48 +02:00
|
|
|
function Store() {
|
2019-08-03 15:03:33 +02:00
|
|
|
this.data = new Map()
|
2018-08-05 16:32:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Sets a value under index key */
|
2018-08-05 18:19:48 +02:00
|
|
|
Store.prototype.set = function(key, value) {
|
2019-08-03 15:03:33 +02:00
|
|
|
this.data.set(key, value)
|
|
|
|
}
|
2018-08-05 16:32:38 +02:00
|
|
|
|
|
|
|
/** Sets a value under index key */
|
2018-08-05 18:19:48 +02:00
|
|
|
Store.prototype.setIfUnset = function(key, value) {
|
2019-08-03 15:03:33 +02:00
|
|
|
if (!this.data.has(key)) this.data.set(key, value)
|
|
|
|
}
|
2018-08-05 16:32:38 +02:00
|
|
|
|
|
|
|
/** Gets a value under index key */
|
2018-08-05 18:19:48 +02:00
|
|
|
Store.prototype.get = function(key) {
|
2019-08-03 15:03:33 +02:00
|
|
|
return this.data.get(key)
|
|
|
|
}
|
2018-08-05 16:32:38 +02:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
export default Store
|