nextapps-de / flexsearch

Next-Generation full text search library for Browser and Node.js
Apache License 2.0
12.53k stars 491 forks source link

Make exports return a Promise that resolves after last callback was called #374

Closed thexeos closed 10 months ago

thexeos commented 1 year ago

Create new variable in document and index exports, which contains a handle for Promise resolve call. When Index is exported directly, then field argument is undefined, thus the Promise is resolved inside the index export method. When Document is exported, then field argument is set, thus preventing Promise to be resolved inside Index export method before all indexes, store, and tags are exported.

There are no breaking changes, although method signature must be updated in documentation, since a Promise is now returned.

Fixes #353

ts-thomas commented 10 months ago

Looks great, thanks a lot