You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Breaking: remove deprecated put, del & batch events
In favor of the `write` event.
While still printing a warning if listeners are added for these
events, because it's cheap and helps people who are upgrading.
Category: removal
Copy file name to clipboardExpand all lines: README.md
-38Lines changed: 0 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -848,8 +848,6 @@ Lastly, one way or another, every implementation _must_ support `data` of type S
848
848
849
849
An `abstract-level` database is an [`EventEmitter`](https://nodejs.org/api/events.html) and emits the events listed below.
850
850
851
-
The `put`, `del` and `batch` events are deprecated in favor of the `write` event and will be removed in a future version of `abstract-level`. If one or more `write` event listeners exist or if the [`prewrite`](#hook--dbhooksprewrite) hook is in use, either of which implies opting-in to the `write` event, then the deprecated events will not be emitted.
852
-
853
851
#### `opening`
854
852
855
853
Emitted when database is opening. Receives 0 arguments:
@@ -967,42 +965,6 @@ The same is true for `db.put()` and `db.del()`.
967
965
968
966
Emitted when a `db.clear()` call completed and entries were thus successfully deleted from the database. Receives a single `options` argument, which is the verbatim `options` argument that was passed to `db.clear(options)` (or an empty object if none) before having encoded range options.
969
967
970
-
#### `put` (deprecated)
971
-
972
-
Emitted when a `db.put()` call completed and an entry was thus successfully written to the database. Receives `key` and `value` arguments, which are the verbatim `key` and `value` that were passed to `db.put(key, value)` before having encoded them.
973
-
974
-
```js
975
-
db.on('put', function (key, value) {
976
-
console.log('Wrote', key, value)
977
-
})
978
-
```
979
-
980
-
#### `del` (deprecated)
981
-
982
-
Emitted when a `db.del()` call completed and an entry was thus successfully deleted from the database. Receives a single `key` argument, which is the verbatim `key` that was passed to `db.del(key)` before having encoded it.
983
-
984
-
```js
985
-
db.on('del', function (key) {
986
-
console.log('Deleted', key)
987
-
})
988
-
```
989
-
990
-
#### `batch` (deprecated)
991
-
992
-
Emitted when a `db.batch([])` or chained `db.batch().write()` call completed and the data was thus successfully written to the database. Receives a single `operations` argument, which is the verbatim `operations` array that was passed to `db.batch(operations)` before having encoded it, or the equivalent for a chained `db.batch().write()`.
993
-
994
-
```js
995
-
db.on('batch', function (operations) {
996
-
for (constopof operations) {
997
-
if (op.type==='put') {
998
-
console.log('Wrote', op.key, op.value)
999
-
} else {
1000
-
console.log('Deleted', op.key)
1001
-
}
1002
-
}
1003
-
})
1004
-
```
1005
-
1006
968
### Order Of Operations
1007
969
1008
970
There is no defined order between parallel write operations. Consider:
0 commit comments