Начальная

Windows Commander

Far
WinNavigator
Frigate
Norton Commander
WinNC
Dos Navigator
Servant Salamander
Turbo Browser

Winamp, Skins, Plugins
Необходимые Утилиты
Текстовые редакторы
Юмор

File managers and best utilites

Fetch API. Api браузера


Push API - Web technology for developers

The Push API gives web applications the ability to receive messages pushed to them from a server, whether or not the web app is in the foreground, or even currently loaded, on a user agent. This lets developers deliver asynchronous notifications and updates to users that opt in, resulting in better engagement with timely new content.

Push concepts and usage

For an app to receive push messages, it has to have an active service worker. When the service worker is active, it can subscribe to push notifications, using PushManager.subscribe().

The resulting PushSubscription includes all the information that the application needs to send a push message: an endpoint and the encryption key needed for sending data.

The service worker will be started as necessary to handle incoming push messages, which are delivered to the ServiceWorkerGlobalScope.onpush event handler. This allows apps to react to push messages being received, for example, by displaying a notification (using ServiceWorkerRegistration.showNotification().)

Each subscription is unique to a service worker.  The endpoint for the subscription is a unique capability URL: knowledge of the endpoint is all that is necessary to send a message to your application. The endpoint URL therefore needs to be kept secret, or other applications might be able to send push messages to your application.

Activating a service worker to deliver a push message can result in increased resource usage, particularly of the battery. Different browsers have different schemes for handling this, there is currently no standard mechanism. Firefox allows a limited number (quota) of push messages to be sent to an application, although Push messages that generate notifications are exempt from this limit. The limit is refreshed each time the site is visited. In comparison, Chrome applies no limit, but requires that every push message causes a notification to be displayed.

Note: As of Gecko 44, the allowed quota of push messages per application is not incremented when a new notification fires, when another is still visible, for a period of three seconds. This handles cases where a burst of Push messages is received, and not all generate a visible notification.

Note: Chrome versions earlier than 52 require you to set up a project on Google Cloud Messaging to send push messages, and use the associated project number and API key when sending push notifications. It also requires an app manifest, with some special parameters to use this service.

Interfaces

PushEvent Represents a push action, sent to the global scope of a ServiceWorker. It contains information sent from an application to a PushSubscription. PushManager Provides a way to receive notifications from third-party servers, as well as request URLs for push notifications. This interface has replaced the functionality offered by the obsolete PushRegistrationManager interface. PushMessageData Provides access to push data sent by a server, and includes methods to manipulate the received data. PushSubscription Provides a subcription's URL endpoint, and allows unsubscription from a push service.

Service worker additions

The following additions to the Service Worker API have been specified in the Push API spec to provide an entry point for using Push messages. They also monitor and respond to push and subscription change events.

ServiceWorkerRegistration.pushManager Read only Returns a reference to the PushManager interface for managing push subscriptions including subscribing, getting an active subscription, and accessing push permission status. This is the entry point into using Push messaging. ServiceWorkerGlobalScope.onpush An event handler fired whenever a push event occurs; that is, whenever a server push message is received. ServiceWorkerGlobalScope.onpushsubscriptionchange An event handler fired whenever a pushsubscriptionchange event occurs; for example, when a push subscription has been invalidated, or is about to be invalidated (e.g. when a push service sets an expiration time.)

Examples

Mozilla's ServiceWorker Cookbook contains many useful Push examples.

Specifications

Specification Status Comment
Push API Working Draft Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 42.0 44.0 (44.0)[1][3] No support[2] ? ?
PushEvent.data,PushMessageData No support 44.0 (44.0)[3] No support No support No support
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support No support 48.0 (48.0)[4] No support ?[2] ? ? 42.0
PushEvent.data,PushMessageData No support No support 48.0 (48.0)[4] No support No support No support No support No support

See also

developer.mozilla.org

Notifications API - Web technology for developers

The Notifications API allows web pages to control the display of system notifications to the end user. These are outside the top-level browsing context viewport, so therefore can be displayed even when the user has switched tabs or moved to a different app. The API is designed to be compatible with existing notification systems, across different platforms.

Concepts and usage

On supported platforms, showing a system notification generally involves two things. First, the user needs to grant the current origin permission to display system notifications, which is generally done when the app or site initialises, using the Notification.requestPermission() method. This will spawn a request dialog, along the following lines:

From here the user can choose to allow notifications from this origin, block notifications from this origin, or not choose at this point. Once a choice has been made, the setting will generally persist for the current session. 

Note: As of Firefox 44, the permissions for Notifications and Push have been merged. If permission is granted for notifications, push will also be enabled.

Next, a new notification is created using the Notification() constructor. This must be passed a title argument, and can optionally be passed an options object to specify options, such as text direction, body text, icon to display, notification sound to play, and more.

In addition, the Notifications API spec specifies a number of additions to the ServiceWorker API, to allow service workers to fire notifications.

Notifications interfaces

Notification Defines a notification object.

Service worker additions

ServiceWorkerRegistration Includes the ServiceWorkerRegistration.showNotification() and ServiceWorkerRegistration.getNotifications() method, for controlling the display of notifications. ServiceWorkerGlobalScope Includes the ServiceWorkerGlobalScope.onnotificationclick handler, for firing custom functions when a notification is clicked. NotificationEvent A specific type of event object, based on ExtendableEvent, which represents a notification that has fired.

Specifications

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 5webkit[1]22 4.0 (2.0)moz[2]22.0 (22.0) No support 25 6[3]
Available in workers 45 41.0 (41.0) ? 32 ?
Service worker additions 42 42.0 (42.0)[4] ? 29 ?
Secure contexts only 62 ? ? 49 ?
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support No support

(Yes)

4.0 (2.0)moz[2]22.0 (22.0) 1.0.1moz[2]1.2 No support (Yes) No support
Available in workers No support 45 41.0 (41.0) (Yes) ? (Yes) ?
Service worker additions No support 42 42.0 (42.0)[4] (Yes) ? 29 ?
Secure contexts only No support 62 ? ? ? 49 ?

[1] Prior to Chrome 22, the support for notification followed an old prefixed version of the specification and used the navigator.webkitNotifications object to instantiate a new notification. Prior to Chrome 32, Notification.permission was not supported.

[2] Prior to Firefox 22 (Firefox OS <1.2), the instantiation of a new notification was done with the navigator.mozNotification object through its createNotification() method. In addition, the Notification was displayed when calling the show() method, and supported only the click and close events (Nick Desaulniers wrote a Notification shim to cover both newer and older implementations.)

[3] Safari started to support notification with Safari 6, but only on Mac OSX 10.8+ (Mountain Lion).

[4] Firefox 42 has shipped with web notifications from Service Workers disabled.

Firefox OS permissions

When using notifications in a Firefox OS app, be sure to add the desktop-notification permission in your manifest file. Notifications can be used at any permission level, hosted or above:

"permissions": { "desktop-notification": {} }

See also

developer.mozilla.org

Fetch API - Web technology for developers

The Fetch API provides an interface for fetching resources (including across the network). It will seem familiar to anyone who has used XMLHttpRequest, but the new API provides a more powerful and flexible feature set.

Concepts and usage

Fetch provides a generic definition of Request and Response objects (and other things involved with network requests). This will allow them to be used wherever they are needed in the future, whether it’s for service workers, Cache API and other similar things that handle or modify requests and responses, or any kind of use case that might require you to generate your own responses programmatically.

It also provides a definition for related concepts such as CORS and the HTTP origin header semantics, supplanting their separate definitions elsewhere.

For making a request and fetching a resource, use the GlobalFetch.fetch method. It is implemented in multiple interfaces, specifically Window and WorkerGlobalScope. This makes it available in pretty much any context you might want to fetch resources in.

The fetch() method takes one mandatory argument, the path to the resource you want to fetch. It returns a Promise that resolves to the Response to that request, whether it is successful or not. You can also optionally pass in an init options object as the second argument (see Request).

Once a Response is retrieved, there are a number of methods available to define what the body content is and how it should be handled (see Body).

You can create a request and response directly using the Request() and Response() constructors, but you are unlikely to do this directly. Instead, these are more likely to be created as results of other API actions (for example, FetchEvent.respondWith from service workers).

Aborting a fetch

Browsers have started to add experimental support for the AbortController and AbortSignal interfaces (aka The Abort API), which allow operations like Fetch and XHR to be aborted if they have not already completed. See the interface pages for more details.

Fetch Interfaces

fetch() The fetch() method used to fetch a resource. Headers Represents response/request headers, allowing you to query them and take different actions depending on the results. Request Represents a resource request. Response Represents the response to a request.

Fetch mixin

Body Provides methods relating to the body of the response/request, allowing you to declare what its content type is and how it should be handled.

Specifications

Specification Status Comment
Fetch Living Standard Initial definition

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) IE Opera Safari (WebKit)
Basic support 42 14 39 (39)34[1]52 (52)[2] No support 2928[1] 10.1
ReadableStream response body 43 14 No support[3] No support ? No support
Feature Android Webview Chrome for Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 42 42 (Yes) (Yes) No support No support 10.1
ReadableStream response body 43 43 (Yes) No support[3] No support ? No support

[1] This API is implemented behind a preference.

[2] Prior to Firefox 52, get() only returned the first value in the specified header, with getAll() returning all values. From 52 onwards, get() now returns all values and getAll() has been removed.

[3] Readable streams are currently enabled in Firefox, but hidden behind the dom.streams.enabled and javascript.options.streams prefs.

See also

developer.mozilla.org


Смотрите также

 

..:::Новинки:::..

Windows Commander 5.11 Свежая версия.

Новая версия
IrfanView 3.75 (рус)

Обновление текстового редактора TextEd, уже 1.75a

System mechanic 3.7f
Новая версия

Обновление плагинов для WC, смотрим :-)

Весь Winamp
Посетите новый сайт.

WinRaR 3.00
Релиз уже здесь

PowerDesk 4.0 free
Просто - напросто сильный upgrade проводника.

..:::Счетчики:::..