You've already forked guangan-mp
1.0.0
This commit is contained in:
22
uni_modules/uni-ajax/js_sdk/lib/adapters/Fetcher.js
Normal file
22
uni_modules/uni-ajax/js_sdk/lib/adapters/Fetcher.js
Normal file
@ -0,0 +1,22 @@
|
||||
const PROMISE = Symbol('$$promise')
|
||||
|
||||
export default class Fetcher {
|
||||
get [Symbol.toStringTag]() {
|
||||
return '[object Fetcher]'
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this[PROMISE] = new Promise((resolve, reject) => {
|
||||
this.resolve = resolve
|
||||
this.reject = reject
|
||||
})
|
||||
}
|
||||
|
||||
async source() {
|
||||
return this[PROMISE]
|
||||
}
|
||||
|
||||
async abort() {
|
||||
;(await this.source())?.abort()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user