Refactor some compat-handling utilities out of dist.ts
#3979
background
wait
wait-all
cancel
Loading