diff options
Diffstat (limited to 'files/uk/web/api/windoweventhandlers')
3 files changed, 213 insertions, 0 deletions
diff --git a/files/uk/web/api/windoweventhandlers/index.html b/files/uk/web/api/windoweventhandlers/index.html new file mode 100644 index 0000000000..cb37cc2a2c --- /dev/null +++ b/files/uk/web/api/windoweventhandlers/index.html @@ -0,0 +1,105 @@ +--- +title: WindowEventHandlers +slug: Web/API/WindowEventHandlers +tags: + - API + - HTML-DOM + - Interface + - Mixin + - NeedsTranslation + - Reference + - TopicStub + - WindowEventHandlers +translation_of: Web/API/WindowEventHandlers +--- +<div>{{APIRef("HTML DOM")}}</div> + +<p>The <strong><code>WindowEventHandlers</code></strong> mixin describes the event handlers common to several interfaces like {{domxref("Window")}}, or {{domxref("HTMLBodyElement")}} and {{domxref("HTMLFrameSetElement")}}. Each of these interfaces can implement additional specific event handlers.</p> + +<div class="blockIndicator note"> +<p><strong>Note</strong>: <code>WindowEventHandlers</code> is a mixin and not an interface; you can't actually create an object of type <code>WindowEventHandlers</code>.</p> +</div> + +<h2 id="Properties">Properties</h2> + +<p><em>The events properties, of the form <code>onXYZ</code>, are defined on the {{domxref("WindowEventHandlers")}}, and implemented by {{domxref("Window")}}, and {{domxref("WorkerGlobalScope")}} for Web Workers.</em></p> + +<dl> + <dt>{{domxref("WindowEventHandlers.onafterprint")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("afterprint")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onbeforeprint")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("beforeprint")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onbeforeunload")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("beforeunload")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onhashchange")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("hashchange")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onlanguagechange")}} {{experimental_inline}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("languagechange")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onmessage")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("message")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onmessageerror")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("MessageError")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onoffline")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("offline")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.ononline")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("online")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onpagehide")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pagehide")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onpageshow")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pageshow")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onpopstate")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("popstate")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onrejectionhandled")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("rejectionhandled")}} event is raised, indicating that a {{jsxref("Promise")}} was rejected and the rejection has been handled.</dd> + <dt>{{domxref("WindowEventHandlers.onstorage")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("storage")}} event is raised.</dd> + <dt>{{domxref("WindowEventHandlers.onunhandledrejection")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("unhandledrejection")}} event is raised, indicating that a {{jsxref("Promise")}} was rejected but the rejection was not handled.</dd> + <dt>{{domxref("WindowEventHandlers.onunload")}}</dt> + <dd>Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("unload")}} event is raised.</dd> +</dl> + +<h2 id="Methods">Methods</h2> + +<p><em>This interface defines no method.</em></p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', '#windoweventhandlers', 'WindowEventHandlers')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>No change since the latest snapshot, {{SpecName("HTML5.1")}}.</td> + </tr> + <tr> + <td>{{SpecName('HTML5.1', '#windoweventhandlers', 'WindowEventHandlers')}}</td> + <td>{{Spec2('HTML5.1')}}</td> + <td>Snapshot of {{SpecName("HTML WHATWG")}}. Added <code>onlanguage</code> since the {{SpecName("HTML5 W3C")}} snapshot.</td> + </tr> + <tr> + <td>{{SpecName("HTML5 W3C", "#windoweventhandlers", "WindowEventHandlers")}}</td> + <td>{{Spec2('HTML5 W3C')}}</td> + <td>Snapshot of {{SpecName("HTML WHATWG")}}. Creation of <code>WindowEventHandlers</code> (properties where on the target before it).</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.WindowEventHandlers")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{domxref("Window")}} and {{domxref("WorkerGlobalScope")}}</li> +</ul> diff --git a/files/uk/web/api/windoweventhandlers/onrejectionhandled/index.html b/files/uk/web/api/windoweventhandlers/onrejectionhandled/index.html new file mode 100644 index 0000000000..81cabc79bd --- /dev/null +++ b/files/uk/web/api/windoweventhandlers/onrejectionhandled/index.html @@ -0,0 +1,52 @@ +--- +title: WindowEventHandlers.onrejectionhandled +slug: Web/API/WindowEventHandlers/onrejectionhandled +tags: + - API + - HTML DOM + - JavaScript + - Promise + - WindowEventHandlers + - onrejectionhandled + - Обробник подій + - Проміс + - події +translation_of: Web/API/WindowEventHandlers/onrejectionhandled +--- +<div>{{APIRef}}</div> + +<p>Властивість <strong><code>onrejectionhandled</code></strong> домішки {{domxref("WindowEventHandlers")}} - це {{domxref("EventHandler")}} для обробки подій <a href="/uk/docs/Web/API/Window/rejectionhandled_event">rejectionhandled</a>. Ці події виникають, коли відхиляються об'єкти {{jsxref("Promise")}}.</p> + +<h2 id="Синтаксис">Синтаксис</h2> + +<pre class="syntaxbox">window.addEventListener("rejectionhandled", function(event) { ... }); +window.onrejectionhandled = function(event) { ...};</pre> + +<h2 id="Приклад">Приклад</h2> + +<pre class="brush: js">window.onrejectionhandled = function(e) { + console.log(e.reason); +}</pre> + +<h2 id="Специфікації">Специфікації</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Специфікація</th> + <th scope="col">Статус</th> + <th scope="col">Коментар</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', 'webappapis.html#handler-window-onrejectionhandled', 'onrejectionhandled')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Початкове визначення.</td> + </tr> + </tbody> +</table> + +<h2 id="Сумісність_з_веб-переглядачами">Сумісність з веб-переглядачами</h2> + + + +<p>{{Compat("api.WindowEventHandlers.onrejectionhandled")}}</p> diff --git a/files/uk/web/api/windoweventhandlers/onunhandledrejection/index.html b/files/uk/web/api/windoweventhandlers/onunhandledrejection/index.html new file mode 100644 index 0000000000..888297c406 --- /dev/null +++ b/files/uk/web/api/windoweventhandlers/onunhandledrejection/index.html @@ -0,0 +1,56 @@ +--- +title: WindowEventHandlers.onunhandledrejection +slug: Web/API/WindowEventHandlers/onunhandledrejection +tags: + - API + - HTML DOM + - Promise + - WindowEventHandlers + - onunhandledrejection + - Властивість + - події + - проміси +translation_of: Web/API/WindowEventHandlers/onunhandledrejection +--- +<div>{{APIRef}}</div> + +<p>Властивість <strong><code>onunhandledrejection</code></strong> домішки {{domxref("WindowEventHandlers")}} - це {{domxref("EventHandler")}} для обробки подій <a href="/uk/docs/Web/API/Window/unhandledrejection_event">unhandledrejection</a>. Ці події виникають для необроблених відхилень об'єктів {{jsxref("Promise")}}.</p> + +<h2 id="Синтаксис">Синтаксис</h2> + +<pre class="syntaxbox">window.onunhandledrejection = <em>function</em>;</pre> + +<h3 id="Значення">Значення</h3> + +<p><code>function</code> - це {{domxref("EventHandler")}} або функція, яку треба викликати, коли вікно отримує події <code>unhandledrejection</code>. Обробник подій отримує вхідний параметр як {{domxref("PromiseRejectionEvent")}}.</p> + +<h2 id="Приклади">Приклади</h2> + +<p>Цей приклад просто виводить у консоль значення <code>reason</code> (причина) необроблених відхилень.</p> + +<pre class="brush: js">window.onunhandledrejection = function(e) { + console.log(e.reason); +}</pre> + +<h2 id="Специфікації">Специфікації</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Специфікація</th> + <th scope="col">Статус</th> + <th scope="col">Коментар</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', 'webappapis.html#handler-window-onunhandledrejection', 'onunhandledrejection')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Початкове визначення.</td> + </tr> + </tbody> +</table> + +<h2 id="Сумісність_з_веб-переглядачами">Сумісність з веб-переглядачами</h2> + + + +<p>{{Compat("api.WindowEventHandlers.onunhandledrejection")}}</p> |