Fix monkey cache

This commit is contained in:
the1812 2022-05-25 21:42:59 +08:00
parent 9e93313b6c
commit fc78c3ada7
3 changed files with 6 additions and 2 deletions

View File

@ -143,7 +143,7 @@ export class DevClient extends EventTarget {
if (!oldComponent) {
return
}
const code: string = await coreApis.ajax.monkey({ url })
const code: string = await monkey({ url })
const { installFeatureFromCode } = await import(
'@/core/install-feature'
)

View File

@ -151,6 +151,7 @@ export const postJsonWithCredentials = (url: string, json: any) => send<string>(
export const monkey = <T = any>(details: MonkeyXhrBasicDetails) => (
new Promise<T>((resolve, reject) => {
const fullDetails: MonkeyXhrDetails = {
nocache: true,
...details,
onload: (r: MonkeyXhrResponse) => resolve(r.response),
onerror: (r: MonkeyXhrResponse) => {

5
src/global.d.ts vendored
View File

@ -51,14 +51,17 @@ declare global {
method?: 'GET' | 'POST' | 'HEAD'
headers?: { [name: string]: string },
data?: string
cookie?: string
binary?: boolean
nocache?: boolean
revalidate?: boolean
timeout?: number
context?: any
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'
overrideMimeType?: string
anonymous?: boolean
fetch?: boolean
username?: string
user?: string
password?: string
}
interface MonkeyXhrDetails extends MonkeyXhrBasicDetails {