From 0b58a4b4fd63b838ae0fc0556067193baa368cb2 Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Wed, 22 May 2024 07:22:48 -0600 Subject: [PATCH] Use correct ArrayBuffer for committed event --- package.json | 2 +- test/index.test.js | 7 +++++++ write.js | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6f3b575ba..e638d97bd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lmdb", "author": "Kris Zyp", - "version": "3.0.9", + "version": "3.0.10", "description": "Simple, efficient, scalable, high-performance LMDB interface", "license": "MIT", "repository": { diff --git a/test/index.test.js b/test/index.test.js index 5d83af27e..a141f31e4 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -919,6 +919,13 @@ describe('lmdb-js', function () { shared_buffer.notify(); }); }); + it('committed event', async function () { + await new Promise((resolve) => { + db.put(5, { name: 'test committed event' }); + db.on('committed', resolve); + }); + }); + it('prefetch', async function () { await new Promise((resolve) => db.prefetch(['key1', 'key2'], resolve)); let key = ''; diff --git a/write.js b/write.js index e5c0d1eec..6ea9cb581 100644 --- a/write.js +++ b/write.js @@ -1082,7 +1082,7 @@ export function addWriteMethods( beforeCommitCallbacks.push(callback); } else if (event == 'aftercommit') afterCommitCallbacks.push(callback); else if (event == 'committed') { - this.getUserSharedBuffer('__committed__', Buffer.from([]), { + this.getUserSharedBuffer('__committed__', new ArrayBuffer(0), { envKey: true, callback, });