mirror of
https://github.com/denoland/deno.git
synced 2025-09-30 14:11:14 +00:00
Support window.onload (#2643)
This commit is contained in:
parent
bd6ebb32df
commit
9c45499864
14 changed files with 162 additions and 88 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue