remove deprecated features, remove 'compaction.done' event, add oncompaction callback, include 'callbackify' polyfill for the browser and use it instead of the 'util' module moved to devDependencies
@ -197,38 +189,29 @@ class Datastore extends EventEmitter {
*mightbeCPU-intensive
*/
constructor(options){
super()
letfilename
// Retrocompatibility with v0.6 and before
if(typeofoptions==='string'){
deprecate(()=>{
filename=options
this.inMemoryOnly=false// Default
},'@seald-io/nedb: Giving a string to the Datastore constructor is deprecated and will be removed in the next major version. Please use an options object with an argument \'filename\'.')()
@ -709,7 +700,7 @@ class Datastore extends EventEmitter {
*@private
*/
_createNewId(){
letattemptId=customUtils.uid(16)
letattemptId=uid(16)
// Try as many times as needed to get an unused _id. As explained in customUtils, the probability of this ever happening is extremely small, so this is O(1)
deprecate(_callback=>this.db.compactDatafile(_callback),'@seald-io/nedb: calling Datastore#persistence#compactDatafile is deprecated, please use Datastore#compactDatafile, it will be removed in the next major version.')(callback)
}
if(this.inMemoryOnly)return
/**
*@seeDatastore#setAutocompactionInterval
*@deprecated
*/
setAutocompactionInterval(interval){
deprecate(_interval=>this.db.setAutocompactionInterval(_interval),'@seald-io/nedb: calling Datastore#persistence#setAutocompactionInterval is deprecated, please use Datastore#setAutocompactionInterval, it will be removed in the next major version.')(interval)
deprecate(()=>this.db.stopAutocompaction(),'@seald-io/nedb: calling Datastore#persistence#stopAutocompaction is deprecated, please use Datastore#stopAutocompaction, it will be removed in the next major version.')()