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 (#104)
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
@@ -856,8 +856,6 @@ Lastly, one way or another, every implementation _must_ support `data` of type S
856
856
857
857
An `abstract-level` database is an [`EventEmitter`](https://nodejs.org/api/events.html) and emits the events listed below.
858
858
859
-
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.
860
-
861
859
#### `opening`
862
860
863
861
Emitted when database is opening. Receives 0 arguments:
@@ -975,42 +973,6 @@ The same is true for `db.put()` and `db.del()`.
975
973
976
974
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.
977
975
978
-
#### `put` (deprecated)
979
-
980
-
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.
981
-
982
-
```js
983
-
db.on('put', function (key, value) {
984
-
console.log('Wrote', key, value)
985
-
})
986
-
```
987
-
988
-
#### `del` (deprecated)
989
-
990
-
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.
991
-
992
-
```js
993
-
db.on('del', function (key) {
994
-
console.log('Deleted', key)
995
-
})
996
-
```
997
-
998
-
#### `batch` (deprecated)
999
-
1000
-
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()`.
1001
-
1002
-
```js
1003
-
db.on('batch', function (operations) {
1004
-
for (constopof operations) {
1005
-
if (op.type==='put') {
1006
-
console.log('Wrote', op.key, op.value)
1007
-
} else {
1008
-
console.log('Deleted', op.key)
1009
-
}
1010
-
}
1011
-
})
1012
-
```
1013
-
1014
976
### Order Of Operations
1015
977
1016
978
There is no defined order between parallel write operations. Consider:
0 commit comments