Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
async-drop-late
Advanced tools
有同学在多次ajax的时候遇到了较早的请求后到导致数据不一致的问题,最好的方案当然是数据包含版本,但这个实现就不依赖后端也能确保数据不会被迟到的ajax结果覆盖
有同学在多次ajax的时候遇到了较早的请求后到导致数据不一致的问题,最好的方案当然是数据包含版本,但这个实现就不依赖后端也能确保数据不会被迟到的ajax结果覆盖
sometimes former ajax result may come late and over write the right data with outdated data, this package keeps the secquence, and reject when the former ajax comes late
const dropLate = require('async-drop-late')
//first async, delay 2second, will resolve after second async and get dropped!
dropLate(delay(1500,'first'))
.then((v)=>console.log(`wrong!`,v))
.catch((e)=>console.log(`first async get dropped!`,e))
dropLate(delay(1000,'second'))
.then((v)=>console.log(`second async done`,v))
.catch((e)=>console.log(`wrong!`,e))
dropLate(delay(2000,'third'))
.then((v)=>console.log(`third async done`,v))
.catch((e)=>console.log(`wrong!`,e))
//different key won't mess up
dropLate(delay(500,'fuorth'),'testkey')
.then((v)=>console.log(`fuorth async with another key done`,v))
.catch((e)=>console.log(`wrong!`,e))
function delay(miliseconds,name){
return new Promise((resolve)=>{
setTimeout(()=>resolve(name),miliseconds)
})
}
FAQs
有同学在多次ajax的时候遇到了较早的请求后到导致数据不一致的问题,最好的方案当然是数据包含版本,但这个实现就不依赖后端也能确保数据不会被迟到的ajax结果覆盖
We found that async-drop-late demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.