如何在GUN中执行原子提交/事务?https://gun.eco/docs/Transactions有点不透明。
我需要执行多个puts,并确保它们(最终)在不干预更改的情况下全部执行。
发布于 2022-07-06 07:53:49
也许您可以使用put中的回调来确保它已经完成:
https://gun.eco/docs/API#-a-name-put-a-gun-put-data-callback-
let gunput = (val) => { return new Promise((res,rej) => {
gun.get('something').put(val, function(ack){
if(ack.err){
res(false)
}
res(true)
})
}
let tx_done = await gunput('test')
if (tx_done) // do next txhttps://stackoverflow.com/questions/72793176
复制相似问题