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 Jul 30, 2023
1 parent 0f8585f commit 696038b
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';

export default Mixin.create({
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';

export default class LocalStorageAdapter extends BaseAdapter {
_storage = getStorage('local');
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';

export default class SessionStorageAdapter extends BaseAdapter {
_storage = getStorage('session');
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 696038b

Please sign in to comment.