Skip to content

Commit

Permalink
Remove array, object, and storage mixins and helpers/utils
Browse files Browse the repository at this point in the history
  • Loading branch information
fsmanuel committed Feb 6, 2024
1 parent 9cde7bf commit 3ec6679
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -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';
import { getOwner } from '@ember/application';
import { associateDestroyableChild } from '@ember/destroyable';
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions addon/adapters/local.js
Original file line number Diff line number Diff line change
@@ -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';
import { getOwner } from '@ember/application';

export default class LocalStorageAdapter extends BaseAdapter {
Expand Down
4 changes: 2 additions & 2 deletions addon/adapters/session.js
Original file line number Diff line number Diff line change
@@ -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';
import { getOwner } from '@ember/application';

export default class SessionStorageAdapter extends BaseAdapter {
Expand Down
15 changes: 13 additions & 2 deletions addon/local/array.js
Original file line number Diff line number Diff line change
@@ -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,
});
15 changes: 13 additions & 2 deletions addon/local/object.js
Original file line number Diff line number Diff line change
@@ -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,
});
15 changes: 0 additions & 15 deletions addon/mixins/array.js

This file was deleted.

15 changes: 0 additions & 15 deletions addon/mixins/object.js

This file was deleted.

15 changes: 13 additions & 2 deletions addon/session/array.js
Original file line number Diff line number Diff line change
@@ -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,
});
15 changes: 13 additions & 2 deletions addon/session/object.js
Original file line number Diff line number Diff line change
@@ -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,
});

0 comments on commit 3ec6679

Please sign in to comment.