import{queueTask}from"./scheduling.js";class Database{deletePending=!1;transactions=[];rawObjectStores=new Map;connections=[];constructor(name,version){this.name=name,this.version=version,this.processTransactions=this.processTransactions.bind(this)}processTransactions(){queueTask((()=>{if(!this.transactions.some((transaction=>transaction._started&&"finished"!==transaction._state))){const next=this.transactions.find((transaction=>!transaction._started&&"finished"!==transaction._state));next&&(next.addEventListener("complete",this.processTransactions),next.addEventListener("abort",this.processTransactions),next._start())}}))}}export default Database;