preloadstore.js 568 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* global MisagoData */
  2. export default function() {
  3. var initData = {};
  4. if (typeof MisagoData !== "undefined") {
  5. initData = MisagoData;
  6. }
  7. return {
  8. data: initData,
  9. has: function(key) {
  10. return this.data.hasOwnProperty(key);
  11. },
  12. get: function(key, value) {
  13. if (this.has(key)) {
  14. return this.data[key];
  15. } else if (value !== undefined) {
  16. return value;
  17. } else {
  18. return undefined;
  19. }
  20. },
  21. set: function(key, value) {
  22. this.data[key] = value;
  23. return value;
  24. }
  25. };
  26. }()