Skip to content

Commit 67bb4ae

Browse files
committed
[scramjet/controller] pass througgh fetch hook
1 parent 4f56868 commit 67bb4ae

File tree

1 file changed

+11
-1
lines changed
  • packages/scramjet/packages/controller/src

1 file changed

+11
-1
lines changed

packages/scramjet/packages/controller/src/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import type * as ScramjetGlobal from "@mercuryworkshop/scramjet";
33

44
declare const $scramjet: typeof ScramjetGlobal;
55

6+
export let Plugin = $scramjet.Plugin;
7+
68
import {
79
type TransportToController,
810
type Controllerbound,
@@ -345,11 +347,15 @@ function yieldGetInjectScripts(
345347
return getInjectScripts;
346348
}
347349

348-
class Frame {
350+
export class Frame {
349351
fetchHandler: ScramjetGlobal.ScramjetFetchHandler;
350352
id: string;
351353
prefix: string;
352354

355+
hooks: {
356+
fetch: ScramjetGlobal.FetchTap;
357+
};
358+
353359
get context(): ScramjetGlobal.ScramjetContext {
354360
let sjcfg = {
355361
...$scramjet.defaultConfig,
@@ -433,6 +439,10 @@ class Frame {
433439
return BareResponse.fromNativeResponse(await fetch(url));
434440
},
435441
});
442+
443+
this.hooks = {
444+
fetch: this.fetchHandler.hooks.fetch,
445+
};
436446
}
437447

438448
go(url: string) {

0 commit comments

Comments
 (0)