Skip to content

Commit

Permalink
Event Follow Up
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftyp committed Sep 17, 2023
1 parent d281581 commit 4d123cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/core/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Preloader, PreloaderDelegate } from "./drive/preloader"

export type FormMode = "on" | "off" | "optin"
export type TimingData = unknown
export type TurboBeforeCacheEvent = CustomEvent
export type TurboBeforeCacheEvent = CustomEvent<void>
export type TurboBeforeRenderEvent = CustomEvent<
{ newBody: HTMLBodyElement; isPreview: boolean } & PageViewRenderOptions
>
Expand Down
8 changes: 4 additions & 4 deletions src/http/fetch_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export interface FetchRequestOptions {
export class FetchRequest {
delegate: FetchRequestDelegate
url: URL
target?: FrameElement | HTMLFormElement | null
target: FrameElement | HTMLFormElement | null
abortController = new AbortController()
fetchOptions: FetchRequestOptions
enctype: string
Expand Down Expand Up @@ -194,7 +194,7 @@ export class FetchRequest {
const event = dispatch<TurboBeforeFetchResponseEvent>("turbo:before-fetch-response", {
cancelable: true,
detail: { fetchResponse },
target: this.target as EventTarget,
target: this.target,
})
if (event.defaultPrevented) {
this.delegate.requestPreventedHandlingResponse(this, fetchResponse)
Expand Down Expand Up @@ -233,14 +233,14 @@ export class FetchRequest {
url: this.url,
resume: this.#resolveRequestPromise,
},
target: this.target as EventTarget,
target: this.target,
})
if (event.defaultPrevented) await requestInterception
}

private willDelegateErrorHandling(error: Error) {
const event = dispatch<TurboFetchRequestErrorEvent>("turbo:fetch-request-error", {
target: this.target as EventTarget,
target: this.target,
cancelable: true,
detail: { request: this, error: error },
})
Expand Down

0 comments on commit 4d123cc

Please sign in to comment.