diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2019-07-16 13:19:26 +0900 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-16 00:19:26 -0400 |
commit | 9c454998646ef49f652bc919f53503ed07a1c55c (patch) | |
tree | a6275bdefa3da50cae08c6c0f753d816215d9602 /js/globals.ts | |
parent | bd6ebb32df11641e148fd0adca41e7188f16afce (diff) |
Support window.onload (#2643)
Diffstat (limited to 'js/globals.ts')
-rw-r--r-- | js/globals.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/js/globals.ts b/js/globals.ts index 1d33f6523..3be55e979 100644 --- a/js/globals.ts +++ b/js/globals.ts @@ -69,6 +69,7 @@ window.console = console; window.setTimeout = timers.setTimeout; window.setInterval = timers.setInterval; window.location = (undefined as unknown) as domTypes.Location; +window.onload = undefined as undefined | Function; // The following Crypto interface implementation is not up to par with the // standard https://www.w3.org/TR/WebCryptoAPI/#crypto-interface as it does not // yet incorporate the SubtleCrypto interface as its "subtle" property. @@ -135,6 +136,28 @@ window.postMessage = workers.postMessage; window.Worker = workers.WorkerImpl; export type Worker = workers.Worker; +window[domTypes.eventTargetHost] = null; +window[domTypes.eventTargetListeners] = {}; +window[domTypes.eventTargetMode] = ""; +window[domTypes.eventTargetNodeType] = 0; +window[eventTarget.eventTargetAssignedSlot] = false; +window[eventTarget.eventTargetHasActivationBehavior] = false; +window.addEventListener = eventTarget.EventTarget.prototype.addEventListener; +window.dispatchEvent = eventTarget.EventTarget.prototype.dispatchEvent; +window.removeEventListener = + eventTarget.EventTarget.prototype.removeEventListener; + +// Registers the handler for window.onload function. +window.addEventListener( + "load", + (e: domTypes.Event): void => { + const onload = window.onload; + if (typeof onload === "function") { + onload(e); + } + } +); + // below are interfaces that are available in TypeScript but // have different signatures export interface ImportMeta { |