mirror of https://github.com/FongMi/TV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
469 B
17 lines
469 B
let req = (url, options) => http(url, Object.assign({
|
|
async: false
|
|
}, options));
|
|
|
|
function http(url, options = {}) {
|
|
if (options?.async === false) return _http(url, options)
|
|
return new Promise(resolve => _http(url, Object.assign({
|
|
complete: res => resolve(res)
|
|
}, options))).catch(err => {
|
|
console.error(err.name, err.message, err.stack)
|
|
return {
|
|
ok: false,
|
|
status: 500,
|
|
url
|
|
}
|
|
})
|
|
} |