Browse Source

Updated the changelog

tags/v2.0.0
Cédric Belin 4 months ago
parent
commit
eb3a182696
2 changed files with 8 additions and 5 deletions
  1. +4
    -1
      CHANGELOG.md
  2. +4
    -4
      lib/src/web_storage.dart

+ 4
- 1
CHANGELOG.md View File

@@ -1,7 +1,10 @@
# Changelog

## Version [2.0.0](https://git.belin.io/cedx/webstorage.dart/compare/v1.4.0...v2.0.0)
- Breaking change: removed the `SimpleChange.fromJson()` factory.
- Breaking change: renamed the `listenToStorageEvents` named parameter to `listenToGlobalEvents`.
- Breaking change: renamed the `onChanges` event stream to `onChange`.
- Breaking change: replaced the map of `SimpleChange` instances by the native `StorageEvent` instance.
- Raised the [Dart SDK](https://dart.dev/tools/sdk) constraint.

## Version [1.4.0](https://git.belin.io/cedx/webstorage.dart/compare/v1.3.0...v1.4.0)
- Updated the documentation.


+ 4
- 4
lib/src/web_storage.dart View File

@@ -50,7 +50,7 @@ abstract class WebStorage extends Object with MapMixin<String, String> { // igno
@override
void clear() {
_backend.clear();
_emit(null, null, null);
_emit(null);
}

/// Gets a value indicating whether this storage contains the given [key].
@@ -95,7 +95,7 @@ abstract class WebStorage extends Object with MapMixin<String, String> { // igno
@override
String remove(Object key) {
final oldValue = _backend.remove(key);
_emit(key, oldValue, null);
_emit(key, oldValue: oldValue);
return oldValue;
}

@@ -103,14 +103,14 @@ abstract class WebStorage extends Object with MapMixin<String, String> { // igno
void set(String key, String value) {
final oldValue = get(key);
_backend[key] = value;
_emit(key, oldValue, value);
_emit(key, oldValue: oldValue, newValue: value);
}

/// Serializes and associates a given [value] to the specified [key].
void setObject(String key, value) => set(key, jsonEncode(value));

/// Emits a new storage event.
void _emit(String key, String oldValue, String newValue, [String url]) => _onChange.add(StorageEvent(
void _emit(String key, {String oldValue, String newValue, String url}) => _onChange.add(StorageEvent(
"change",
key: key,
oldValue: oldValue,


Loading…
Cancel
Save