Skip to content

Commit

Permalink
feat: add more helper functions to controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Dec 15, 2024
1 parent 519c4e3 commit 5420494
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/controller/frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 7 additions & 1 deletion src/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ScramjetController {
flags: {
serviceworkers: false,
naiiveRewriter: false,
captureErrors: true,
captureErrors: false,
strictRewrites: true,
syncxhr: false,
cleanerrors: false,
Expand Down Expand Up @@ -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<IDBDatabase> {
const db = indexedDB.open("$scramjet", 1);

Expand Down

0 comments on commit 5420494

Please sign in to comment.