function myAsyncFun (url) {
return new Promise ( (resolve, reject) => {
const xhr = new XMLHttpRequest()
xhr.open('GET', url)
xhr.onload = () => {resolve(xhr.responseText)}
xhr.onerror = () => {reject(xhr.statusText)}
xhr.send()
})
}
const url = 'http://bj-m-213985a:8099/public/live/play?appname=newsapp&appver=620&applt=ios&tags=newsapp&program_token=20001043'
myAsyncFun(url).then( (response) => {
console.log('加载成功', response)
throw new Error()
}, () => {
console.log('加载失败')
}).catch( () => {
console.log('捉到catch')
})
console