From ebdd2a03de44c6a51e837dbb2dbe6400d8bc6b40 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
import.meta
The JavaScript specification defines a syntax for modules, as well as some host-agnostic parts
@@ -88391,12 +88394,41 @@ document.querySelector("button").addEventListener("click", bound);
scripts versus module scripts, since both of them use
the script
element.
A module map is a map of URL records to values that are either a module script, null (used to
- represent failed fetches), or a placeholder value "fetching
". Module maps are used to ensure that imported JavaScript modules are
- only fetched, parsed, and evaluated once per Document
or worker.
import(specifier)
Returns a promise for the module namespace object for the module script
+ identified by specifier. This allows dynamic importing of module scripts at runtime,
+ instead of statically using the import
statement form. The specifier will
+ be resolved relative to the active
+ script's base URL.
The returned promise will be rejected if an invalid specifier is given, or if a failure is + encountered while fetching or evaluating the resulting module graph.
+ +This syntax can be used inside both classic and module scripts. It thus provides a bridge into the module-script + world, from the classic-script world.
+import . meta
. url
Returns the active module script's base URL.
+ +This syntax can only be used inside module scripts.
+A module map is a map of URL records to values that are either a module script,
+ null (used to represent failed fetches), or a placeholder value "fetching
". Module maps are used to ensure
+ that imported JavaScript modules are only fetched, parsed, and evaluated once per
+ Document
or worker.
Since module maps are keyed by URL, the following code will @@ -88428,6 +88460,8 @@ import "https://example.com/foo/../module2.mjs"; data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url.
To resolve a module specifier given a URL base URL and a JavaScript string specifier, perform the following steps. It will return either a URL record or failure.
@@ -88452,14 +88486,18 @@ import "https://example.com/foo/../module2.mjs"; base URL as the base URL. +The following are valid module specifiers according to the above algorithm:
+The following are valid module specifiers according to the above + algorithm:
https://example.com/apples.mjs
http:example.com\pears.js
(becomes http://example.com/pears.js
as step 1 parses with no base URL)//example.com/bananas
In various scenarios, the user agent can report an exception by firing an error
event at the Window
. If this event is not canceled,
+ then the error is considered not handled, and can be reported to the developer console.
When the user agent is required to report an error for a @@ -88919,11 +88963,8 @@ import "https://example.com/foo/../module2.mjs"; data-x="concept-error-nothandled">not handled after this, then the error may be reported to a developer console.
-ErrorEvent
interface[Constructor(DOMString type, optional ErrorEventInit eventInitDict), Exposed=(Window,Worker)]
interface ErrorEvent : Event {
readonly attribute DOMString message;
@@ -88959,6 +89000,8 @@ dictionary ErrorEventInit : EventInit {
it was initialized to. Where appropriate, it is set to the object representing the error (e.g.,
the exception object in the case of an uncaught DOM exception).
+
In addition to synchronous runtime script errors, scripts
@@ -88966,6 +89009,8 @@ dictionary ErrorEventInit : EventInit {
data-x="event-unhandledrejection">unhandledrejection and rejectionhandled
events.
When the user agent is to notify about rejected promises on a given environment settings object settings object, it must run these steps:
@@ -89111,11 +89156,11 @@ dictionary PromiseRejectionEventInit : EventInit { -To coordinate events, user interaction, scripts, rendering, networking, and so forth, user agents must use event loops as @@ -89141,6 +89186,8 @@ dictionary PromiseRejectionEventInit : EventInit { event loop, and the worker processing model manages the event loop's lifetime.
+An event loop has one or more task queues. A @@ -89942,8 +89989,10 @@ dictionary PromiseRejectionEventInit : EventInit { specified. These act as non-capture event listeners for the object on which they are specified.
+An event handler is a struct with two items: + data-x="struct item">items:
a value, which is either nullPromiseRejectionEventInit : EventInit { set to null.
Event handlers are exposed in two ways.
The first way, common to all event handlers, is as an