Skip to content
This repository was archived by the owner on May 27, 2022. It is now read-only.

Commit 3d18948

Browse files
authored
Merge pull request #111 from data-provider/release
Release v2.2.2
2 parents cacce70 + 013b466 commit 3d18948

File tree

9 files changed

+45
-17
lines changed

9 files changed

+45
-17
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Fixed
1111
### Removed
1212

13+
## [2.2.2] - 2020-12-27
14+
15+
### Added
16+
- docs(readme): Add example about using default tag
17+
18+
### Changed
19+
- chore(deps): Update dependencies
20+
- refactor: Use baseTags getter to define base tag (#109)
21+
1322
## [2.2.1] - 2020-12-14
1423

1524
### Added

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,21 @@ userPreferences.query({ prop: "cookiesAccepted" }).delete()
122122
userPreferences.delete();
123123
```
124124

125+
## Tags
126+
127+
Providers created with this addon will have automatically the `browser-storage` tag, so you can select all of them together using the `providers` methods as in:
128+
129+
```javascript
130+
import { providers } from "@data-provider/core";
131+
132+
providers.getByTag("browser-storage").cleanCache();
133+
```
134+
135+
Apart of this common tag, each different type of `browser-storage` origin also has next tags:
136+
137+
* `LocalStorage`: "local-storage"
138+
* `SessionStorage`: "session-storage"
139+
125140
## Contributing
126141

127142
Contributors are welcome.

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@data-provider/browser-storage",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"description": "Data Provider addon providing localStorage and sessionStorage origins",
55
"keywords": [
66
"data-provider",
@@ -43,7 +43,7 @@
4343
"devDependencies": {
4444
"@babel/core": "7.12.3",
4545
"@babel/preset-env": "7.12.1",
46-
"@data-provider/core": "2.8.2",
46+
"@data-provider/core": "2.9.0",
4747
"@rollup/plugin-babel": "5.2.2",
4848
"@rollup/plugin-commonjs": "17.0.0",
4949
"@rollup/plugin-json": "4.1.0",

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
sonar.organization=data-provider
22
sonar.projectKey=data-provider-browser-storage
3-
sonar.projectVersion=2.2.1
3+
sonar.projectVersion=2.2.2
44

55
sonar.sources=src,test
66
sonar.exclusions=node_modules/**

src/LocalStorage.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ Unless required by applicable law or agreed to in writing, software distributed
1010
*/
1111

1212
import { Storage } from "./Storage";
13+
import { TAG, LOCAL_TAG } from "./tags";
1314

1415
export class LocalStorage extends Storage {
1516
constructor(id, options, query) {
1617
super(id, { ...options, storageKey: "localStorage" }, query);
1718
}
19+
20+
get baseTags() {
21+
return [TAG, LOCAL_TAG];
22+
}
1823
}

src/SessionStorage.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ Unless required by applicable law or agreed to in writing, software distributed
1010
*/
1111

1212
import { Storage } from "./Storage";
13+
import { TAG, SESSION_TAG } from "./tags";
1314

1415
export class SessionStorage extends Storage {
1516
constructor(id, options, query) {
1617
super(id, { ...options, storageKey: "sessionStorage" }, query);
1718
}
19+
20+
get baseTags() {
21+
return [TAG, SESSION_TAG];
22+
}
1823
}

src/Storage.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ Unless required by applicable law or agreed to in writing, software distributed
1313

1414
import { Provider } from "@data-provider/core";
1515

16-
const TAG = "browser-storage";
17-
const storageKeysTags = {
18-
localStorage: "local-storage",
19-
sessionStorage: "session-storage",
20-
};
21-
2216
class StorageMock {
2317
constructor() {
2418
this._value = "{}";
@@ -49,10 +43,7 @@ class StorageErrorMock {
4943

5044
export class Storage extends Provider {
5145
constructor(id, options, query) {
52-
const tags = options.tags ? [...options.tags] : [];
53-
tags.unshift(storageKeysTags[options.storageKey]);
54-
tags.unshift(TAG);
55-
const extendedOptions = { ...options, tags };
46+
const extendedOptions = { ...options };
5647
if (!query) {
5748
extendedOptions.parentId = id;
5849
}

src/tags.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const TAG = "browser-storage";
2+
export const LOCAL_TAG = "local-storage";
3+
export const SESSION_TAG = "session-storage";

0 commit comments

Comments
 (0)