From 542049470e3d3e92040189ca6e8a1d7ec4b014f8 Mon Sep 17 00:00:00 2001 From: Percs <83934299+Percslol@users.noreply.github.com> Date: Sun, 15 Dec 2024 17:23:33 -0600 Subject: [PATCH] feat: add more helper functions to controller --- src/controller/frame.ts | 4 ++++ src/controller/index.ts | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/controller/frame.ts b/src/controller/frame.ts index 1b94fcd..9326362 100644 --- a/src/controller/frame.ts +++ b/src/controller/frame.ts @@ -15,6 +15,10 @@ export class ScramjetFrame extends EventTarget { return this.frame.contentWindow.window[SCRAMJETCLIENT]; } + get url(): URL { + return this.client.url; + } + go(url: string | URL) { if (url instanceof URL) url = url.toString(); diff --git a/src/controller/index.ts b/src/controller/index.ts index e988c96..a0c85a1 100644 --- a/src/controller/index.ts +++ b/src/controller/index.ts @@ -29,7 +29,7 @@ export class ScramjetController { flags: { serviceworkers: false, naiiveRewriter: false, - captureErrors: true, + captureErrors: false, strictRewrites: true, syncxhr: false, cleanerrors: false, @@ -84,6 +84,12 @@ export class ScramjetController { return $scramjet.config.prefix + $scramjet.codec.encode(url); } + decodeUrl(url: string | URL) { + if (url instanceof URL) url = url.toString(); + + return $scramjet.codec.decode(url); + } + async openIDB(): Promise { const db = indexedDB.open("$scramjet", 1);