mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-16 07:30:02 -04:00
whatever
This commit is contained in:
parent
e0671f4648
commit
0d84f77084
3 changed files with 22 additions and 1 deletions
|
@ -68,8 +68,10 @@ export class ScramjetClient {
|
|||
constructor(public global: typeof globalThis) {
|
||||
this.serviceWorker = this.global.navigator.serviceWorker;
|
||||
|
||||
if ("document" in self) {
|
||||
if ("document" in global) {
|
||||
this.documentProxy = createDocumentProxy(this, global);
|
||||
|
||||
global.document[SCRAMJETCLIENT] = this;
|
||||
}
|
||||
|
||||
this.locationProxy = createLocationProxy(this, global);
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
export const nativeFunction = self.Function;
|
||||
export const nativeGetOwnPropertyDescriptor =
|
||||
self.Object.getOwnPropertyDescriptor;
|
||||
|
||||
// descriptors
|
||||
export const nativeDefaultViewGetter = nativeGetOwnPropertyDescriptor(
|
||||
Document.prototype,
|
||||
"defaultView"
|
||||
)!.get!;
|
||||
export const nativeContentDocumentGetter = nativeGetOwnPropertyDescriptor(
|
||||
HTMLIFrameElement.prototype,
|
||||
"contentDocument"
|
||||
)!.get!;
|
||||
export const nativeContentWindowGetter = nativeGetOwnPropertyDescriptor(
|
||||
HTMLIFrameElement.prototype,
|
||||
"contentWindow"
|
||||
)!.get!;
|
||||
|
|
5
src/types.d.ts
vendored
5
src/types.d.ts
vendored
|
@ -83,6 +83,11 @@ declare global {
|
|||
[SCRAMJETCLIENT]: ScramjetClient;
|
||||
}
|
||||
|
||||
interface HTMLDocument {
|
||||
// should be the same as window
|
||||
[SCRAMJETCLIENT]: ScramjetClient;
|
||||
}
|
||||
|
||||
interface HTMLIFrameElement {
|
||||
// the event target belonging to an <iframe> holding a /prefix/blah url
|
||||
[SCRAMJETFRAME]: ScramjetFrame;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue