diff --git a/addon/mixins/storage.js b/addon/-private/legacy-mixins/storage.js similarity index 98% rename from addon/mixins/storage.js rename to addon/-private/legacy-mixins/storage.js index ae82651..b2779cf 100644 --- a/addon/mixins/storage.js +++ b/addon/-private/legacy-mixins/storage.js @@ -1,7 +1,7 @@ import Mixin from '@ember/object/mixin'; import { set, get } from '@ember/object'; import { isArray, A } from '@ember/array'; -import { getStorage } from '../helpers/storage'; +import { getStorage } from 'ember-local-storage/helpers/storage'; import { copy } from 'ember-copy'; export default Mixin.create({ diff --git a/addon/helpers/utils.js b/addon/-private/legacy-utils.js similarity index 100% rename from addon/helpers/utils.js rename to addon/-private/legacy-utils.js diff --git a/addon/adapters/local.js b/addon/adapters/local.js index 4b7d30a..8a75f9d 100644 --- a/addon/adapters/local.js +++ b/addon/adapters/local.js @@ -1,7 +1,7 @@ import { get } from '@ember/object'; import BaseAdapter from './base'; -import { getStorage, _buildKey } from '../helpers/storage'; -import StorageArray from '../local/array'; +import { getStorage, _buildKey } from 'ember-local-storage/helpers/storage'; +import StorageArray from 'ember-local-storage/local/array'; export default class LocalStorageAdapter extends BaseAdapter { _storage = getStorage('local'); diff --git a/addon/adapters/session.js b/addon/adapters/session.js index abc7daf..951ac6d 100644 --- a/addon/adapters/session.js +++ b/addon/adapters/session.js @@ -1,7 +1,7 @@ import { get } from '@ember/object'; import BaseAdapter from './base'; -import { getStorage, _buildKey } from '../helpers/storage'; -import StorageArray from '../session/array'; +import { getStorage, _buildKey } from 'ember-local-storage/helpers/storage'; +import StorageArray from 'ember-local-storage/session/array'; export default class SessionStorageAdapter extends BaseAdapter { _storage = getStorage('session'); diff --git a/addon/local/array.js b/addon/local/array.js index 4ed2fd4..502301b 100644 --- a/addon/local/array.js +++ b/addon/local/array.js @@ -1,6 +1,17 @@ +import { A } from '@ember/array'; import ArrayProxy from '@ember/array/proxy'; -import ArrayProxyMixin from '../mixins/array'; +import { set } from '@ember/object'; +import StorageProxyMixin from 'ember-local-storage/-private/legacy-mixins/storage'; +import { save } from 'ember-local-storage/-private/legacy-utils'; -export default ArrayProxy.extend(ArrayProxyMixin, { +export default ArrayProxy.extend(StorageProxyMixin, { + _initialContent: A(), _storageType: 'local', + + _clear() { + set(this, 'content', A()); + }, + + replaceContent: save, + reset: save, }); diff --git a/addon/local/object.js b/addon/local/object.js index e7c1a74..fb5287f 100644 --- a/addon/local/object.js +++ b/addon/local/object.js @@ -1,6 +1,17 @@ +import { set } from '@ember/object'; import ObjectProxy from '@ember/object/proxy'; -import ObjectProxyMixin from '../mixins/object'; +import StorageProxyMixin from 'ember-local-storage/-private/legacy-mixins/storage'; +import { save, saveIfChanged } from 'ember-local-storage/-private/legacy-utils'; -export default ObjectProxy.extend(ObjectProxyMixin, { +export default ObjectProxy.extend(StorageProxyMixin, { + _initialContent: {}, _storageType: 'local', + + _clear() { + set(this, 'content', {}); + }, + + setUnknownProperty: saveIfChanged, + set: saveIfChanged, + setProperties: save, }); diff --git a/addon/mixins/array.js b/addon/mixins/array.js deleted file mode 100644 index 5d3e956..0000000 --- a/addon/mixins/array.js +++ /dev/null @@ -1,15 +0,0 @@ -import { A } from '@ember/array'; -import Mixin from '@ember/object/mixin'; -import { set } from '@ember/object'; -import StorageProxyMixin from './storage'; -import { save } from '../helpers/utils'; - -export default Mixin.create(StorageProxyMixin, { - _initialContent: A(), - _clear() { - set(this, 'content', A()); - }, - - replaceContent: save, - reset: save, -}); diff --git a/addon/mixins/object.js b/addon/mixins/object.js deleted file mode 100644 index 543d600..0000000 --- a/addon/mixins/object.js +++ /dev/null @@ -1,15 +0,0 @@ -import Mixin from '@ember/object/mixin'; -import { set } from '@ember/object'; -import StorageProxyMixin from './storage'; -import { save, saveIfChanged } from '../helpers/utils'; - -export default Mixin.create(StorageProxyMixin, { - _initialContent: {}, - _clear() { - set(this, 'content', {}); - }, - - setUnknownProperty: saveIfChanged, - set: saveIfChanged, - setProperties: save, -}); diff --git a/addon/session/array.js b/addon/session/array.js index 467b969..66b1155 100644 --- a/addon/session/array.js +++ b/addon/session/array.js @@ -1,6 +1,17 @@ +import { A } from '@ember/array'; import ArrayProxy from '@ember/array/proxy'; -import ArrayProxyMixin from '../mixins/array'; +import { set } from '@ember/object'; +import StorageProxyMixin from 'ember-local-storage/-private/legacy-mixins/storage'; +import { save } from 'ember-local-storage/-private/legacy-utils'; -export default ArrayProxy.extend(ArrayProxyMixin, { +export default ArrayProxy.extend(StorageProxyMixin, { + _initialContent: A(), _storageType: 'session', + + _clear() { + set(this, 'content', A()); + }, + + replaceContent: save, + reset: save, }); diff --git a/addon/session/object.js b/addon/session/object.js index e5b9b3a..52b728a 100644 --- a/addon/session/object.js +++ b/addon/session/object.js @@ -1,6 +1,17 @@ +import { set } from '@ember/object'; import ObjectProxy from '@ember/object/proxy'; -import ObjectProxyMixin from '../mixins/object'; +import StorageProxyMixin from 'ember-local-storage/-private/legacy-mixins/storage'; +import { save, saveIfChanged } from 'ember-local-storage/-private/legacy-utils'; -export default ObjectProxy.extend(ObjectProxyMixin, { +export default ObjectProxy.extend(StorageProxyMixin, { + _initialContent: {}, _storageType: 'session', + + _clear() { + set(this, 'content', {}); + }, + + setUnknownProperty: saveIfChanged, + set: saveIfChanged, + setProperties: save, });