mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 22:40:01 -04:00
feat: add more helper functions to controller
This commit is contained in:
parent
519c4e3486
commit
542049470e
2 changed files with 11 additions and 1 deletions
|
@ -15,6 +15,10 @@ export class ScramjetFrame extends EventTarget {
|
||||||
return this.frame.contentWindow.window[SCRAMJETCLIENT];
|
return this.frame.contentWindow.window[SCRAMJETCLIENT];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get url(): URL {
|
||||||
|
return this.client.url;
|
||||||
|
}
|
||||||
|
|
||||||
go(url: string | URL) {
|
go(url: string | URL) {
|
||||||
if (url instanceof URL) url = url.toString();
|
if (url instanceof URL) url = url.toString();
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ export class ScramjetController {
|
||||||
flags: {
|
flags: {
|
||||||
serviceworkers: false,
|
serviceworkers: false,
|
||||||
naiiveRewriter: false,
|
naiiveRewriter: false,
|
||||||
captureErrors: true,
|
captureErrors: false,
|
||||||
strictRewrites: true,
|
strictRewrites: true,
|
||||||
syncxhr: false,
|
syncxhr: false,
|
||||||
cleanerrors: false,
|
cleanerrors: false,
|
||||||
|
@ -84,6 +84,12 @@ export class ScramjetController {
|
||||||
return $scramjet.config.prefix + $scramjet.codec.encode(url);
|
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> {
|
async openIDB(): Promise<IDBDatabase> {
|
||||||
const db = indexedDB.open("$scramjet", 1);
|
const db = indexedDB.open("$scramjet", 1);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue