Search completed in 1.14 seconds.
Using the Notifications API - Web APIs
the
notifications api lets a web page or app send
notifications that are displayed outside the page at the system level; this lets web apps send information to a user even if the application is idle or in the background.
... typically, system
notifications refer to the operating system's standard notification mechanism: think for example of how a typical desktop system or mobile device broadcasts
notifications.
... the system notification system will vary of course by platform and browser, but this is ok, and the
notifications api is written to be general enough for compatibility with most system notification systems.
...And 26 more matches
Web Push API Notifications best practices - Web APIs
this article provides a useful summary of best practices to keep in mind when developing web sites and applications that use push
notifications for user engagement.
... “if done well, it's nice to have, but if not done well, it's really annoying.” — overheard conversation between two browser developers discussing the ethics of push
notifications.
... overview of web push
notifications web push
notifications (created using a combination of the
notifications, push, and service worker apis) are part of the rising noise that product developers and marketers are using to get attention for their sites.
...And 14 more matches
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
but instead of relying only on user actions, we can do more, using push messages and
notifications to automatically re-engage and deliver new content whenever it is available.
... two apis, one goal the push api and
notifications api are two separate apis, but they work well together when you want to provide engaging functionality in your app.
...
notifications can be used by the service worker to show new information to the user, or at least alert them when something has been updated.
...And 12 more matches
PopupNotifications.jsm
the popup
notifications.jsm javascript code module provides a popup notification box service.
... this service is used, for example, to display geolocation related
notifications.
... to use this, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/popup
notifications.jsm"); once you've imported the module, you can then use the popup
notifications object it exports; this object provides methods for creating and displaying popup notification panels.
...And 11 more matches
Notifications API - Web APIs
the
notifications api allows web pages to control the display of system
notifications to the end user.
...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 should be done in response to a user gesture, such as clicking a button, for example: btn.addeventlistener('click', function() { let promise = notification.requestpermission(); // wait for permission }) this is not only best practice — you should not be spamming users with
notifications they didn't agree to — but going forward browsers will explicitly disallow
notifications not triggered in response to a user gesture.
...And 8 more matches
Using popup notifications
popup
notifications, also known as "doorhanger
notifications", are presented to notify the user of something that's important but may not need immediate attention.
... these non-modal
notifications let the user make decisions when they have a moment to do so, instead of being forced to deal with them at possibly inconvenient times.
...in addition,
notifications can be dismissed and recalled by clicking anywhere outside the notification, then clicking on the notification icon to bring it back again.
...And 6 more matches
Receiving startup notifications
sometimes it's necessary for xpcom components to receive
notifications as to the progress of the application's startup process, so they can start new services at appropriate times, for example.
... receiving startup
notifications in gecko 2.0 (firefox 4) and later in order to improve startup times, changes were made to the xpcom startup process.
...your add-on will not receive xpcom-startup or app-startup
notifications.
...And 3 more matches
ServiceWorkerRegistration.getNotifications() - Web APIs
the get
notifications() method of the serviceworkerregistration interface returns a list of the
notifications in the order that they were created from the current origin via the current service worker registration.
...
notifications created by one service worker on the same origin will not be available to other active services workers on that same origin.
... syntax s​erviceworkerregistration.get
notifications(options) .then(function(
notificationslist) { ...
...And 3 more matches
notifications - Archive of obsolete content
usage this api supports desktop
notifications on windows, os x using growl (and notification center as of os x 10.9 mavericks), and linux using libnotify.
... var
notifications = require("sdk/
notifications");
notifications.notify({ title: "jabberwocky", text: "'twas brillig, and the slithy toves", data: "did gyre and gimble in the wabe", onclick: function (data) { console.log(data); // console.log(this.data) would produce the same result.
... var
notifications = require("sdk/
notifications"); var self = require("sdk/self"); var myiconurl = self.data.url("myicon.png");
notifications.notify({ text: "i have an icon!", iconurl: myiconurl }); from firefox 34, you can use "./myicon.png" as an alias for self.data.url("myicon.png").
...And 2 more matches
User Notifications and Alerts - Archive of obsolete content
this kind on notification is very easy to implement, it doesn't interrupt the user and is easy to read and dismiss, so it is our recommended way of displaying alerts and
notifications.
... there's a catch, though: these
notifications are inside the current tab, so switching tabs will make a notification disappear.
...this means that these
notifications make the most sense when they are related to the page currently being displayed, such as a page trying to install an add-on, or a site you just entered a password on.
...And 2 more matches
Observer Notifications
see receiving startup
notifications for more information about how this works.
... documents these topics indicate
notifications you can monitor related to dom documents.
... io
notifications these topics can be used to watch the io service for useful information.
...And 2 more matches
Observer Notifications - Archive of obsolete content
an observer is an object that is responsible to observe (wait for)
notifications and then to carry out subsequent actions.
... useful firefox
notifications we have covered sending and receiving custom notification topics using observers and the observer service.
...the observer
notifications page lists some useful topics and is definitely worth spending time studying it.
Displaying notifications (deprecated) - Archive of obsolete content
to see how to use the standard api, please read: using web
notifications mobile only in gecko 2.0 available only in firefox mobile as of gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) firefox offers support for "desktop
notifications"; these are
notifications that are displayed to the user outside the context of the web content, using the standard notification system provided by the operating system.
... for example, on android,
notifications appear in the bar at the top of the screen, and in the panel that appears when you drag that bar downward.
... setting up event listeners on the notification there are two events you can listen to on created
notifications: onclick this event is fired when the user clicks (or taps) on the notification.
BluetoothRemoteGATTCharacteristic.startNotifications() - Web APIs
the bluetoothremotegattcharacteristic.start
notifications() method returns a promise to the bluetoothremotegattcharacteristic instance when there is an active notification on it.
... syntax bluetoothremotegattcharacteristic.start
notifications().then(function(bluetoothremotegattcharacteristic) { ...
... specifications specification status comment web bluetooththe definition of 'start
notifications()' in that specification.
BluetoothRemoteGATTCharacteristic.stopNotifications() - Web APIs
the bluetoothremotegattcharacteristic.stop
notifications() method returns a promise to the bluetoothremotegattcharacteristic instance when there is no longer an active notification on it.
... syntax bluetoothremotegattcharacteristic.stop
notifications().then(function(bluetoothremotegattcharacteristic) { ...
... specifications specification status comment web bluetooththe definition of 'stop
notifications()' in that specification.
Notifications - Archive of obsolete content
the namespace for this class is jetpack.
notifications.
... titlethe head of the notification message.string bodythe message itself.stringfalse iconthe url of an .ico file.string jetpack.
notifications.show("hello world"); var mybody = " my first message body on jetpack"; var myicon = "http://www.mozilla.com/favicon.ico"; jetpack.
notifications.show({title: "my first message on jetpack", body: mybody, icon: myicon}); ...
removeTransientNotifications - Archive of obsolete content
« xul reference home removetransient
notifications( ) return type: no return value remove only those
notifications that have a persistence value of zero, and decrements by one the persistence value of those that have a non-zero value.
Index - Web APIs
328 bluetoothremotegattcharacteristic.start
notifications() api, bluetooth, bluetoothremotegattcharacteristic, experimental, property, reference, web bluetooth api, start
notifications() the bluetoothremotegattcharacteristic.start
notifications() method returns a promise to the bluetoothremotegattcharacteristic instance when there is an active notification on it.
... 329 bluetoothremotegattcharacteristic.stop
notifications() api, bluetooth, bluetoothremotegattcharacteristic, experimental, property, reference, web bluetooth api, stop
notifications the bluetoothremotegattcharacteristic.stop
notifications() method returns a promise to the bluetoothremotegattcharacteristic instance when there is no longer an active notification on it.
...for a full working example, see our to-do
notifications app (view example live.) 2031 idbfactory.cmp() api, database, idbfactory, indexeddb, method, reference, storage, cmp an integer that indicates the result of the comparison; the table below lists the possible values and their meanings: 2032 idbfactory.deletedatabase() api, database, idbfactory, indexeddb, method, reference, storage, deletedatabase the dele...
...And 45 more matches
Index
72 observer
notifications xpcom, xpcom:add-ons the following are topics that you can observe during the course of an application.
... 118 receiving startup
notifications component manager, embedding mozilla, needsupdate, xpcom sometimes it's necessary for xpcom components to receive
notifications as to the progress of the application's startup process, so they can start new services at appropriate times, for example.
... 187 imgidecoderobserver interfaces, interfaces:scriptable, needscontent, reference, xpcom interface reference, needsattention we make the distinction here between "load" and "decode"
notifications.
...And 13 more matches
IME handling guide
then, mozilla::imecontentobserver::ime
notificationsender tries to send the pending
notifications when it might become safe to do that.
... see also
notifications to ime section for the detail of sending
notifications.
...when puppetwidget receives
notifications to ime from imecontentobserver in the remote process, it makes this class modify its cached content.
...And 12 more matches
Index - Archive of obsolete content
see displaying
notifications for an example.
... 48
notifications add-on sdk,
notifications display transient, toaster-style desktop messages to the user.
... 172 alerts and
notifications code snippets non-modal notification and further interaction with users 173 autocomplete code snippets, form fill, satchel no summary!
...And 10 more matches
Notification - Web APIs
the notification interface of the
notifications api is used to configure and display desktop
notifications to the user.
... these
notifications' appearance and specific functionality vary across platforms but generally they provide a way to asynchronously provide information to the user.
... notification.permission read only a string representing the current permission to display
notifications.
...And 8 more matches
imgIDecoderObserver
1.0 66 introduced gecko 12.0 inherits from: imgicontainerobserver last changed in gecko 1.7 we make the distinction here between "load" and "decode"
notifications.
... load
notifications are fired as the image is loaded from the network or filesystem.
... decode
notifications are fired as the image is decoded.
...And 7 more matches
notificationbox - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the notificationbox element is used to display
notifications above an element.
...the
notifications appear at the top of the box.
... the
notifications may be placed at the bottom by setting the dir attribute to reverse.
...And 6 more matches
nsIFaviconService
this will make the
notifications more efficient since the icon will already have data when the set favicon observer messages goes out.
...this function does not send out
notifications that the data has changed.
...but sending out those
notifications is very intensive.
...And 5 more matches
Notification.permission - Web APIs
the permission read-only property of the notification interface indicates the current permission granted by the user for the current origin to display web
notifications.
...the value can be: granted: the user has explicitly granted permission for the current origin to display system
notifications.
... denied: the user has explicitly denied permission for the current origin to display system
notifications.
...And 4 more matches
Notification.requestPermission() - Web APIs
read using the
notifications api for a good example of how to feature detect this and run code as appropriate.
... the requestpermission() method of the notification interface requests permission from the user for the current origin to display
notifications.
...possible values for this string are: granted denied default examples assume this basic html: <button onclick="notifyme()">notify me!</button> it's possible to send a notification as follows — here we present a fairly verbose and complete set of code you could use if you wanted to first check whether
notifications are supported, then check if permission has been granted for the current origin to send
notifications, then request permission if required, before then sending a notification.
...And 4 more matches
Index of archived content - Archive of obsolete content
testing the add-on sdk two types of scripts working with events xul migration guide high-level apis addon-page base64 clipboard context-menu hotkeys indexed-db l10n
notifications page-mod page-worker panel passwords private-browsing querystring request selection self simple-prefs simple-storage system tabs timers ui url widget ...
...eb pages based on url modifying the page hosted by a tab open a web page troubleshooting unit testing using xpcom without chrome using third-party modules (jpm) bootstrapped extensions code snippets alerts and
notifications autocomplete bookmarks boxes canvas code snippets cookies customizing the download progress bar delayed execution dialogs and prompts downloading files drag & drop embedding svg examples and demos from articles file i/o finding win...
... banner panels homeprovider.jsm homestorage nativewindow contextmenus doorhanger menu toast
notifications.jsm pageactions.jsm prompt.jsm runtimepermissions.jsm snackbars.jsm sound.jsm tab addons developer guide code snippets creating a user interface firefox hub walkthrough initialization and cleanup prerequisites ...
...And 3 more matches
Monitoring plugins - Archive of obsolete content
this component then reports the plugin runtime using the observer service to anyone registered to receive the
notifications.
... usage to make use of the new component you must register to receive its runtime
notifications using the observer service.
... below are a number of javascript snippets that would be useful to developers trying to use this feature: registration to register for runtime
notifications with the observer service you must create a class with an observe method which receives 3 parameters (subject, topic and data) as well as a register method that contains the following code: var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice (components.interfaces.nsiobserverservice); observerservice.addobserver(this, "experimental-noti...
...And 3 more matches
nsIObserver
xpcom/ds/nsiobserver.idlscriptable this interface is implemented by an object that wishes to observe
notifications.
... these
notifications are often, though not always, broadcast via the nsiobserverservice.
... you should not modify, add, remove, or enumerate
notifications in the implementation of this method.
...And 3 more matches
Introduction to progressive web apps - Progressive web apps (PWAs)
an app could be considered a pwa when it meets certain requirements, or implements a set of given features: works offline, is installable, is easy to synchronize, can send push
notifications, etc.
... re-engageable, so it's able to send
notifications whenever there's new content available.
... re-engaging with users through the use of system
notifications and push messages, leading to more engaged users and better conversion rates.
...And 3 more matches
Index - Archive of obsolete content
555 removeall
notifications xul methods, xul reference no summary!
... 566 removetransient
notifications xul methods, xul reference no summary!
... 619 all
notifications xul properties, xul reference no summary!
...And 2 more matches
Working with Svelte stores - Learn web development
components can subscribe to stores and receive
notifications when their values change.
... objective: learn how to use svelte stores using stores we will create an alert component that shows
notifications on screen, which can receive messages from any component.
...these kind of widgets might also be known as popup
notifications, toast, or notification bubbles.
...And 2 more matches
Overview of Mozilla embedding APIs
in addition to memory allocation and release, this service provides low memory
notifications, called a memory pressure observers, which are notified when memory is low - thus allowing cached resources to be freed.
...the embedding application receives
notifications from gecko through a set of callback interfaces it may choose to implement.
...context menu
notifications right-click context menu
notifications are passed up to the embedding application through the nsicontextmenulistener interface.
...And 2 more matches
nsIMemory
if you need to monitor low memory conditions, you should watch for the low memory
notifications "memory-pressure"
notifications instead.
... low memory
notifications an nsimemory implementation may be capable of monitoring heap usage.
... moreover, a mechanism exists by which a client can receive
notifications about low-memory situations.
...And 2 more matches
nsIMsgFolder
inputstream getofflinefilestream(in nsmsgkey msgkey, out pruint32 offset, out pruint32 size); void downloadmessagesforoffline(in nsisupportsarray messages, in nsimsgwindow window); nsimsgfolder getchildwithuri(in acstring uri, in boolean deep, in boolean caseinsensitive); void downloadallforoffline(in nsiurllistener listener, in nsimsgwindow window); void enable
notifications(in long notificationtype, in boolean enable, in boolean dbbatching); boolean iscommandenabled(in acstring command); boolean matchorchangefilterdestination(in nsimsgfolder folder,in boolean caseinsensitive); boolean confirmfolderdeletionforfilter(in nsimsgwindow msgwindow); void alertfilterchanged(in nsimsgwindow msgwindow); void throwalertmsg(in string...
... manyheaderstodownload boolean readonly: used to determine if it will take a long time to download all the headers in this folder - so that we can do folder
notifications synchronously instead of asynchronously.
... nsmsgdispositionstate_none -1 nsmsgdispositionstate_replied 0 nsmsgdispositionstate_forwarded 1 allmessagecount
notifications 0 turn
notifications on/off for various notification types.
...And 2 more matches
nsINavHistoryObserver
delete
notifications aren't quite 100% accurate.
... batch delete operations take place in two steps; the
notifications come first, followed by a bulk delete.
...delete
notifications are not quite 100% accurate.
...And 2 more matches
nsIObserverService
xpcom/ds/nsiobserverservice.idlscriptable this interface provides methods to add, remove, notify, and enumerate observers of various
notifications.
... inherits from: nsisupports last changed in gecko 0.9.6 the xpcom nsobserverservice implements this interface to provide global
notifications for a variety of subsystems.
... void addobserver( in nsiobserver anobserver, in string atopic, in boolean ownsweak); nsisimpleenumerator enumerateobservers( in string atopic ); void notifyobservers( in nsisupports asubject, in string atopic, in wstring somedata ); void removeobserver( in nsiobserver anobserver, in string atopic ); methods addobserver() registers a given listener for a
notifications regarding the specified topic.
...And 2 more matches
Setting HTTP request headers
(in our example, our made up http header is x-hello and not hello because we correctly added the x- in front of our name.) no longer the case: http://tools.ietf.org/html/rfc6648
notifications the question that may be coming to your mind right now is, how do you get the nsihttpchannel when an http request is made.
...trapping other requests is done with
notifications, which are a lot like events or signals found in other languages and frameworks.
...(and yes, "http-on-modify-request" is a string.) note: there are many topics, besides just "http-on-modify-request", that you can get
notifications about, for example "http-on-examine-response" and "xpcom-shutdown".
...And 2 more matches
Mail event system
if the object wants to know about all
notifications on all folders, then it should register with the mail session.
... nsimsgmailsession.idl is a service that acts as a broadcaster for folder
notifications.
... the mail session receives all
notifications from all folders, and then forwards it on to any nsifolderlisteners that have registered themselves.
...And 2 more matches
Push API - Web APIs
this lets developers deliver asynchronous
notifications and updates to users that opt in, resulting in better engagement with timely new content.
...when the service worker is active, it can subscribe to push
notifications, using pushmanager.subscribe().
...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.
...And 2 more matches
Progressive web apps (PWAs)
this guide explains how a2hs is used, and what you need to do as a developer to allow your users to take advantage of it.how to make pwas installablein this article, we learned about how we can make pwas installable with a properly-configured web manifest, and how the user can then install the pwa with the "add to home screen" feature of their browser.how to make pwas re-engageable using
notifications and pushhaving the ability to cache the contents of an app to work offline is a great feature.
...but instead of relying only on user actions, we can do more, using push messages and
notifications to automatically re-engage and deliver new content whenever it is available.introduction to progressive web appsthis article provides an introduction to progressive web apps (pwas), discussing what they are and the advantages they offer over regular web apps.making pwas work offline with service workersin this article we took a simple look at how you can make your pwa work offline with service workers.
... progressive loadingin previous articles we covered apis that help us make our js13kpwa example a progressive web app: service workers, web manifests,
notifications and push.
...And 2 more matches
Intercepting Page Loads - Archive of obsolete content
http
notifications are fired for all http requests originating from firefox.
... there are 2 http topics you can listen to, as specified in the observer
notifications page: topic description http-on-modify-request called as an http request is made.
... you won't be able to make dom modifications like with the load events, since these
notifications are triggered before the response arrives and is parsed into dom tree, so this is not the best approach for the typical greasemonkey-style extensions.
... the aforementioned observer
notifications page has more information about these
notifications and links to other useful documentation.
Updating addons broken by private browsing changes - Archive of obsolete content
iwebbrowserpersist ff 19: nsicontentprefservice nsidownloadmanager nsidownload nsihttpauthmanager nsistricttransportsecurityservice ff 20: nsiprivatebrowsingservice nsirecentbadcertservice furthermore, if your code uses any of these common chrome apis: ff 19: saveurl saveinternal openlinkin ff 20: openbrowserwindow gprivatebrowsingui finally, if your code watches for any of these observer
notifications: private-browsing private-browsing-cancel-vote private-browsing-change-granted private-browsing-transition-complete then your addon will require updating to correctly support the new per-window private browser feature in firefox 20 (and will require updating to work correctly in releases of firefox since the ones listed).
...addprivacyawarelistener should be used instead, or no
notifications will be received for private downloads.
... observer
notifications none of the ones listed above will be sent as of firefox 20.
... the supporting per-window private browsing article explains further about the equivalent
notifications, which are all backwards compatible through to firefox 12 (and are sent side-by-side with the global private browsing
notifications in older versions).
RDF Modifications - Archive of obsolete content
there are two main situations when the
notifications are made.
...the second situation when
notifications are made is when a datasource is being loaded or reloaded.
... actually, internally, this isn't any different than the other
notifications, but it is worth discussing separately.
...if the reloaded datasource hasn't changed, the builder won't receive any
notifications.
Introduction to the server side - Learn web development
it can even allow interaction with users of the site, sending
notifications and updates via email or through other channels.
...sending
notifications).
... a deeper analysis of user habits can be used to anticipate their interests and further customize responses and
notifications, for example providing a list of previously visited or popular locations you may want to look at on a map.
...
notifications and communication servers can send general or user-specific
notifications through the website itself or via email, sms, instant messaging, video conversations, or other communications services.
DownloadList
to receive change
notifications for downloads that are added to the list, use the addview() method to register for ondownloadchanged
notifications.
...the newly added view will receive ondownloadadded
notifications for all the downloads that are already in the list.
... promise resolves to undefined when the view has been registered and all the ondownloadadded
notifications for the existing downloads have been sent.
...at this point, the removed view will not receive any more
notifications.
Querying Places
notifications sent to the result from the history and bookmarks system, as well as commands executed by the programmer such as sorting may cause the structure to change and nodes may be inserted, removed, or replaced.
...this viewer will be called when the result tree changes, either as a result of user action or as a result of
notifications from the bookmarks and history systems.
...while a container is open, it will listen to the history and bookmarks systems'
notifications and modify their contents to keep themselves up-to-date.
...if you close a container and re-open it before any history or bookmark change
notifications come, the results will generally still be there and this operation will be fast.
Starting WebLock
registering for
notifications the nsiobserverservice interface has methods for registering and unregistering an nsiobserver object.
... there are two startup
notifications, both of which create the observer if it isn't already created.
...embedding applications may provide other
notifications.
... common xpcom
notifications category name value creates component xpcom-startup any contract id yes xpcom-shutdown any contract id no xpcom-autoregistration any contract id no app-startup any service, contract id * the table above summarizes the popular persistent
notifications registered through the category manager.
nsIHttpActivityDistributor
tributor;1 as a service: var httpactivitydistributor = components.classes["@mozilla.org/network/http-activity-distributor;1"] .getservice(components.interfaces.nsihttpactivitydistributor); method overview void addobserver(in nsihttpactivityobserver aobserver); void removeobserver(in nsihttpactivityobserver aobserver); methods addobserver() begins delivery of
notifications of http transport activity.
... void addobserver( in nsihttpactivityobserver aobserver ); parameters aobserver the nsihttpactivityobserver that should receive
notifications of http transport activity; this object's nsihttpactivityobserver.observeactivity() method will be called each time activity occurs.
... removeobserver() stops delivery of
notifications of http transport activity.
... void removeobserver( in nsihttpactivityobserver aobserver ); parameters aobserver the nsihttpactivityobserver that should no longer receive
notifications of http transport activity.
nsIMemoryReporterManager
registermultireporter() requests that memory multi-reporter
notifications be sent to the specified objects.
... registerreporter() requests that memory reporter
notifications be sent to the specified objects.
... unregistermultireporter() stops sending memory multi-reporter
notifications to the specified object.
... unregisterreporter() stops sending memory reporter
notifications to the specified object.
nsINavBookmarkObserver
other
notifications will be sent during the batch change, but the observer is guaranteed that onendupdatebatch() will be called at the completion of changes.
... during a batch the observer should do its best to reduce the work done to handle
notifications, since multiple changes are going to happen in a short timeframe.
...when a new item is created, all the items following it in the same folder will have their index shifted down, but no additional
notifications will be sent.
...when an item is removed, all the items following it in the same folder will have their index shifted down, but no additional
notifications will be sent.
Permissions.query() - Web APIs
firefox for example currently supports geolocation,
notifications, push, and persistent-storage (see our permissions.webidl file).
... uservisibleonly: (push only, not supported in firefox — see the browser support section below) indicates whether you want to show a notification for every message or be able to send silent push
notifications.
... note: as of firefox 44, the permissions for
notifications and push have been merged.
...by the user, in the relevant permissions dialog), navigator.permissions.query() will return true for both
notifications and push.
Permissions.revoke() - Web APIs
valid values are 'geolocation', 'midi', '
notifications', and 'push'.
... uservisibleonly: (push only, not supported in firefox — see the browser compatibility section below) indicates whether you want to show a notification for every message or be able to send silent push
notifications.
... note: as of firefox 44, the permissions for
notifications and push have been merged.
...by the user, in the relevant permissions dialog), navigator.permissions.query() will return true for both
notifications and push.
Structural overview of progressive web apps - Progressive web apps (PWAs)
in addition to the basic shell, you can add other features such as add to home screen or push
notifications, safe in the knowledge that the app will still work ok if they are not supported by the user's browser — this is the beauty of progressive enhancement.
...you can <a href="https://github.com/mdn/pwa-examples/blob/master/js13kpwa"> fork js13kpwa on github</a> to check its source code.</p> <button id="
notifications">request dummy
notifications</button> <section id="content"> // content inserted in here </section> </main> <footer> <p>© js13kgames 2012-2018, created and maintained by <a href="http://end3r.com"> andrzej mazur</a> from <a href="http://enclavegames.com">enclave games</a>.</p> </footer> </body> </html> the <head> section contains basic information about the app, including its title...
... .replace(/github/g,games[i].github); entry = entry.replace('<a href=\'http:///\'></a>','-'); content += entry; }; document.getelementbyid('content').innerhtml = content; then it registers a service worker: if ("serviceworker" in navigator) { navigator.serviceworker.register("/pwa-examples/js13kpwa/sw.js"); } after that, the app adds a handler for clicks on a button whose id is
notifications; this handler requests permission to send
notifications to the user, then generates and sends a random notification.
... var button = document.getelementbyid("
notifications"); button.addeventlistener('click', function(e) { notification.requestpermission().then(function(result) { if (result === 'granted') { randomnotification(); } }); }); the randomnotification() function follows, rounding out the last of the code in the file: function randomnotification() { var randomitem = math.floor(math.random()*games.length); var notiftitle = games[randomitem].name; var notifbody = 'created by '+games[randomitem].author+'.'; var notifimg = 'data/img/'+games[randomitem].slug+'.jpg'; var options = { body: notifbody, icon: notifimg } var notif = new notification(notiftitle, options); settimeout(randomnotification, 30000); } the service worker the last file we'll briefly look at here is...
Inline options - Archive of obsolete content
if you need script support, see the display
notifications section.
..."radio" title="options 2"> <radiogroup> <radio value="false" label="disabled"/> <radio value="true" label="enabled"/> </radiogroup> </setting> <!-- button example - not tied to a preference, but attached to a command --> <setting title="do something" type="control"> <button id="myaddon-button" label="click me" oncommand="alert('thank you!');"/> </setting> setting element changed
notifications most of the setting elements (it might be all i havent really looked), support oninputchanged attribute.
... some discussion on the subject at stackoverflow: how to use addeventlistener on inputchanged of inline options display
notifications if you want to use the settings ui for anything more than storing preferences, then you will probably need to initialize them when they first appear.
notification - Archive of obsolete content
persistence type: integer the persistence may be set to a non-zero value so that the notificationbox's removetransient
notifications method does not remove them.
... this may be used to close a set of
notifications as a group without affecting other
notifications.
... priority type: integer numeric value that specifies the order in which the
notifications appear.
Creating Sandboxed HTTP Connections
channel.asyncopen(listener, null); http
notifications the above mentioned listener is a nsistreamlistener, which gets notified about events such as http redirects and data availability.
... since nsistreamlistener does not cover cookies, the current channel being used will need to be stored as a global, since another listener will be used for cookie
notifications (covered in the next section).
... the observer service (nsiobserverservice) is used to send general
notifications, including the two cookie ones.
Performance
le.jsm") // getmaincopy() used by other functions don't register observers (and other callbacks to global services) in a frame script bad: //framescript.js services.obs.addobserver("document-element-inserted", { observe: function(doc, topic, data) { if(doc.ownerglobal.top != content) return; // bail out if this is for another tab decoratedocument(doc); } }) observer
notifications get fired for events that happen anywhere in the browser, they are not scoped to the current tab.
... better: content-document-global-created
notifications can be substituted with domwindowcreated events other observers and services should be registered in a process script or jsm instead load frame scripts on demand bad: // addon.js services.mm.loadframescript("framescript.js", /*delayed:*/ true) // stuff communicating with the framescript // framescript.js function onlyonceinabluemoon() { // we only need this during a total solar ecl...
...er: // addon.js function onunload() { services.mm.removedelayedframescript("resources://my-addon/framescript.js"); services.ppmm.removedelayedprocessscript("resources://my-addon/processcript.js"); services.mm.broadcastasyncmessage("my-addon:unload"); services.ppmm.broadcastasyncmessage("my-addon:unload"); } in the frame/process scripts: remove all kinds of listeners remove observer
notifications remove custom categories and services nuke sandboxes unload jsms restore content dom states where necessary, e.g.
Introduction to NSPR
manipulate the monitored data notify(condition); exit(monitor);
notifications to a condition do not accumulate.
...if multiple threads are actually processing the
notifications, one or more of them could be scheduled ahead of the one explicitly promoted by the notification.
...philosophically, timeouts should be treated as explicit
notifications, and therefore require the testing of the monitored data upon resumption.
XPCOM changes in Gecko 2.0
category registration prior to gecko 2, extensions could listen for the xpcom-startup and app-startup
notifications during startup, and perform actions during those.
...that's because it's among the earliest
notifications that occurs after the profile folder (and therefore preferences and other services) is available.
...see receiving startup
notifications for details.
nsICookieService
var cookiesvc = components.classes["@mozilla.org/cookieservice;1"] .getservice(components.interfaces.nsicookieservice);
notifications this service broadcasts the following
notifications when the cookie list is changed, or a cookie is rejected: topic subject data cookie-changed broadcast whenever the cookie list changes in some way.
... aprompt the prompt to use for all user-level cookie
notifications.
... aprompt the prompt to use for all user-level cookie
notifications.
nsINavHistoryResult
the viewer provides
notifications to the controller when view events occur; this is done using the nsinavhistoryresultviewobserver interface.
... suppress
notifications boolean if true,
notifications are suppressed.
...void addobserver( in nsinavhistoryresultobserver aobserver, in boolean aownsweak ); parameters aobserver an object that implements the nsinavhistoryresultobserver interface, which will receive
notifications of changes on the result.
nsIRequest
load_background 1 << 0 do not deliver status
notifications to the nsiprogresseventsink, or keep this load from completing the nsiloadgroup it may belong to.
... implementations must not send any
notifications (for example via nsirequestobserver) synchronously from this function.
... calling cancel() on a suspended request must not send any
notifications (such as onstoprequest) until the request is resumed.
nsITransport
void seteventsink( in nsitransporteventsink asink, in nsieventtarget aeventtarget ); parameters asink receives transport layer
notifications.
... aeventtarget indicates the event target to which the
notifications should be delivered.
... if null, then the
notifications may occur on any thread.
nsIWebProgress
a nsiwebprogresslistener instance receives
notifications for the nsiwebprogress instance to which it added itself, and it may also receive
notifications from any nsiwebprogress instances that are children of that nsiwebprogress instance.
... notify_all 0x000000ff <= gecko 1.8.1 0x000001ff > gecko 1.8.1 this flag enables all
notifications.
...anotifymask the types of
notifications to receive.
about:debugging (before Firefox 68) - Firefox Developer Tools
workers the workers page shows your workers, categorised as follows: all registered service workers all registered shared workers other workers, including chrome workers and dedicated workers you can connect the developer tools to each worker, and send push
notifications to service workers.
... to debug push
notifications, you can set a breakpoint in the push event listener.
... however, you can also debug push
notifications locally, without needing the server.
about:debugging - Firefox Developer Tools
workers the workers section shows all the workers you've got registered on your firefox, categorised as follows: all registered service workers all registered shared workers other workers, including chrome workers and dedicated workers you can connect the developer tools to each worker, and send push
notifications to service workers.
... sending push events to service workers to debug push
notifications, you can set a breakpoint in the push event listener.
... however, you can also debug push
notifications locally, without needing the server.
BluetoothCharacteristicProperties - Web APIs
notifyread only returns a boolean that is true if
notifications of the characteristic value without acknowledgement is permitted.
... examples the following example shows how tell if a gatt characteristic supports value change
notifications.
...it device.gatt.connect(); let service = await gatt.getprimaryservice('heart_rate'); let characteristic = await service.getcharacteristic('heart_rate_measurement'); if (characteristic.properties.notify) { characteristics.addeventlistener('characteristicvaluechanged', function(event) { console.log(`received heart rate measurement: ${event.target.value}`); } await characteristic.start
notifications(); } specifications specification status comment web bluetooththe definition of 'bluetoothcharacteristicproperties' in that specification.
BluetoothRemoteGATTCharacteristic - Web APIs
value; promise<bluetoothremotegattdescriptor> getdescriptor(bluetoothdescriptoruuid descriptor); promise<sequence<bluetoothremotegattdescriptor>> getdescriptors(optional bluetoothdescriptoruuid descriptor); promise<dataview> readvalue(); promise<void> writevalue(buffersource value); promise<void> start
notifications(); promise<void> stop
notifications(); }; bluetoothremotegattcharacteristic implements eventtarget; bluetoothremotegattcharacteristic implements characteristiceventhandlers; properties bluetoothremotegattcharacteristic.serviceread only returns the bluetoothgattservice this characteristic belongs to.
... bluetoothremotegattcharacteristic.start
notifications() returns a promise when navigator.bluetooth is added to the active notification context.
... bluetoothremotegattcharacteristic.stop
notifications() returns a promise when navigator.bluetooth is removed from the active notification context.
Checking when a deadline is due - Web APIs
the main example application we will be referring to in this article is to-do list
notifications, a simple to-do list application that stores task titles and deadline times and dates via indexeddb, and then provides users with
notifications when deadline dates are reached, via the notification, and vibration apis.
... you can download the to-do list
notifications app from github and play around with the source code, or view the app running live.
...if not, we drop a message into our developer
notifications pane (see the bottom left of the app ui) to tell the user what is going on, and exit out of the function.
MutationObserver - Web APIs
methods disconnect() stops the mutationobserver instance from receiving further
notifications until and unless observe() is called again.
... observe() configures the mutationobserver to begin receiving
notifications through its callback function when dom changes matching the given options occur.
... takerecords() removes all pending
notifications from the mutationobserver's notification queue and returns them in a new array of mutationrecord objects.
Notification.tag - Web APIs
one notification can then be programmatically replaced with another to avoid the users' screen being filled up with a huge number of similar
notifications.
... examples our using the
notifications api article has a good example of tag usage.
... specifications specification status comment
notifications apithe definition of 'tag' in that specification.
NotificationAction - Web APIs
the notificationaction interface of the
notifications api is used to represent action buttons the user can click to interact with
notifications.
... example
notifications can fire notificationclick events on the serviceworkerglobalscope.
...ve', title: 'archive' } ] }); self.addeventlistener('notificationclick', function(event) { event.notification.close(); if (event.action === 'archive') { // archive action was clicked archiveemail(); } else { // main body of notification was clicked clients.openwindow('/inbox'); } }, false); specifications specification status comment
notifications api living standard living standard ...
ServiceWorkerGlobalScope.onnotificationclick - Web APIs
notifications created on the main thread or in workers which aren't service workers using the notification() constructor will instead receive a click event on the notification object itself.
....waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }; specifications specification status comment
notifications apithe definition of 'onnotificationclick' in that specification.
...this property is specified on the
notifications_api even though it's part of serviceworkerglobalscope.
onnotificationclose - Web APIs
notifications created on the main thread or in workers which aren't service workers using the notification() constructor will instead receive a close event on the notification object itself.
...self.onnotificationclose = function(event) { console.log('on notification close: ', event.notification.tag); }; specifications specification status comment
notifications apithe definition of 'onnotificationclick' in that specification.
...this property is specified on the
notifications_api even though it's part of serviceworkerglobalscope.
ServiceWorkerRegistration.showNotification() - Web APIs
if this value is absent or false, the desktop version of chrome will auto-minimize
notifications after approximately twenty seconds.
... you can also retrieve details of the
notifications that have been fired from the current service worker using serviceworkerregistration.get
notifications().
... specifications specification status comment
notifications apithe definition of 'shownotification()' in that specification.
Testing media queries programmatically - CSS: Cascading Style Sheets
once you've created a mediaquerylist object, you can check the result of the query or receive
notifications when the result changes.
...hmedia("(orientation: portrait)"); checking the result of a query once you've created your media query list, you can check the result of the query by looking at the value of its matches property: if (mediaquerylist.matches) { /* the viewport is currently in portrait orientation */ } else { /* the viewport is not currently in portrait orientation, therefore landscape */ } receiving query
notifications if you need to be aware of changes to the evaluated result of the query on an ongoing basis, it's more efficient to register a listener than to poll the query's result.
... ending query
notifications to stop receiving
notifications about changes to the value of your media query, call removelistener() on the mediaquerylist, passing it the name of the previously-defined callback function: mediaquerylist.removelistener(handleorientationchange); ...
Progressive web app structure - Progressive web apps (PWAs)
in addition to the basic shell, you can add other features such as add to home screen or push
notifications, safe in the knowledge that the app will still work ok if they are not supported by the user's browser — this is the beauty of progressive enhancement.
...you can <a href="https://github.com/mdn/pwa-examples/blob/master/js13kpwa">fork js13kpwa on github</a> to check its source code.</p> <button id="
notifications">request dummy
notifications</button> <section id="content"> // content inserted in here </section> </main> <footer> <p>© js13kgames 2012-2018, created and maintained by <a href="http://end3r.com">andrzej mazur</a> from <a href="http://enclavegames.com">enclave games</a>.</p> </footer> </body> </html> the <head> section contains some basic info like title, description and links to css, web...
...e/g,games[i].website) .replace(/github/g,games[i].github); entry = entry.replace('<a href=\'http:///\'></a>','-'); content += entry; }; document.getelementbyid('content').innerhtml = content; next, it registers a service worker: if('serviceworker' in navigator) { navigator.serviceworker.register('/pwa-examples/js13kpwa/sw.js'); }; the next code block requests permission for
notifications when a button is clicked: var button = document.getelementbyid("
notifications"); button.addeventlistener('click', function(e) { notification.requestpermission().then(function(result) { if(result === 'granted') { randomnotification(); } }); }); the last block creates
notifications that display a randomly-selected item from the games list: function randomnotif...
Navigator.mozNotification - Archive of obsolete content
see displaying
notifications for an example.
... permissions when using
notifications in an open web app, be sure to add the desktop-notification permission in your manifest file: "permissions": { "desktop-notification": {} } usage notes in firefox 22+, the instantiation of a new notification should be done with the notification object by calling new notification(title, options).
Progress Listeners - Archive of obsolete content
in the examples below the progress listener is attached to the tabbrowser, which means you don't get any
notifications for inactive tabs.
...instead, you receive those events that the tabbrowser is interested in, except that the onlinkiconavailable and onrefreshattempted
notifications are optional.
Session store API - Archive of obsolete content
starting in firefox 3.5,
notifications are sent after reading session store data and before using it, as well as immediately before writing it back to disk.
... see the list in observer
notifications.
Layout System Overview - Archive of obsolete content
for example, the presentation shell receives
notifications of document load events, which are used to trigger updates to the formatting of the frames in some cases.
... the presentation shell also receives
notifications about changes in cursor and focus states, whereby the selection and caret updates can be made visible.
Basics - Archive of obsolete content
class
notifications the notification box appears at the bottom right corner of the browser and displays important information to the user.
... titlethe head of the notification message.string bodythe messagestringfalse iconthe url of an .ico file.string jetpack.
notifications.show("hello world");var mybody = " my first message body on jetpack";var myicon = "http://www.mozilla.com/favicon.ico";jetpack.
notifications.show({title: "my first message on jetpack", body: mybody, icon: myicon}); class tabs in this class you can find information about the tabs in your firefox window.
Menu - Archive of obsolete content
sn't do anything: jetpack.menu.add("two drink holders and a captain's chair"); add a menuitem to the jetpack menu that displays the current date and time each time it's opened: jetpack.menu.add(function () new date().tostring()); click an item in the jetpack menu to be notified of the current date and time: jetpack.menu.add({ label: "show current date and time", command: function () jetpack.
notifications.show(new date()) }); the same, except on the content context menu: jetpack.menu.context.page.add({ label: "show current date and time", command: function () jetpack.
notifications.show(new date()) }); create a submenu within the content context menu.
...note that the submenu contains many items, including a menu separator: jetpack.menu.context.page.add({ label: "ice cream", icon: "http://example.com/ice-cream.png", menu: new jetpack.menu(["vanilla", "chocolate", "pistachio", null, "none"]), command: function (menuitem) jetpack.
notifications.show(menuitem.label) }); add an item to the hyperlink context menu that tweets the link: jetpack.menu.context.page.on("a").add(function (context) { return { label: "tweet", command: function () jetpack.lib.twitter.statuses.update({ status: context.node.href }) }; )); add an item to the page's context menu depending on some complex criteria that can't be completely expressed via a css selector: jetpack.menu.context.page.befo...
persistence - Archive of obsolete content
« xul reference home persistence type: integer the persistence may be set to a non-zero value so that the notificationbox's removetransient
notifications method does not remove them.
... this may be used to close a set of
notifications as a group without affecting other
notifications.
Property - Archive of obsolete content
« xul reference accessible accessibletype accesskey align all
notifications allowevents alwaysopenpopup amindicator applocale autocheck autofill autofillaftermatch boxobject browsers builder builderview buttons canadvance cangoback cangoforward canrewind checked checkstate child children classname clickselectsall clientheight clientwidth collapsed color columns command commandmanager completedefaultindex container contentdocument contentprincipal contenttitle contentview contentvieweredit contentviewerfile contentwindow contextmenu control controller controllers crop current currentindex currentitem currentnotification currentpage currentpane currentset currenturi customtoolbarco...
...k ispm issearching iswaiting itemcount label labelelement lastpermanentchild lastselected left linkedpanel listboxobject locked markupdocumentviewer max maxheight maxlength maxrows maxwidth menu menuboxobject menupopup min minheight minresultsforpopup minwidth minute minuteleadingzero mode month monthleadingzero name next nomatch
notificationshidden object observes onfirstpage onlastpage open ordinal orient pack pagecount pageid pageincrement pageindex pagestep parentcontainer palette persist persistence placeholder pmindicator popup popupboxobject popupopen position predicate preferenceelements preferencepanes preferences priority radiogroup readonly readonly ref resou...
Introduction to web APIs - Learn web development
examples include telling the user that a useful update is available on a web app via system
notifications (see the
notifications api) or vibration hardware (see the vibration api).
...as an example, the
notifications api asks for permission using a pop-up dialogue box: the web audio and htmlmediaelement apis are subject to a security mechanism called autoplay policy — this basically means that you can't automatically play audio when a page loads — you've got to allow your users to initiate audio play through a control like a button.
Creating a Language Pack
// lots of
notifications about missing entities ...
... // lots of
notifications about missing entities ...
Listening to events on all tabs
adding a listener to listen to progress events on all tabs, call the browser's addtabsprogresslistener() method: gbrowser.addtabsprogresslistener(myprogresslistener); myprogresslistener is an object that implements the callbacks used to provide
notifications of progress events.
... note: these
notifications will only occur if a security package is installed.
Limitations of chrome scripts
observers for these topics get content objects as the asubject argument to observe(), so
notifications are not sent to the chrome process.
... in multiprocess firefox, notificationcallbacks is a special object that tries to emulate the single-process
notificationscallbacks object as best it can.
Embedding Tips
register your own nsiwebprogresslistener object to listen for progress and state
notifications.
... register your ownnsiwebprogresslistener object to listen for progress and state
notifications.
Getting from Content to Layout
the frame constructor takes these
notifications and does the following: dispatches "restyle events" which trigger the reprocessing of relevant css selectors and any restyling that needs to occur.
... the restyles accumulated in the restyletracker are dispensed with from various method on the presshell that involve reflow and flushing
notifications.
Implementing Download Resuming
(it is possible to pass an empty string as the id; however, this means that you have no assurance that the file remained unchanged) now, you can open the channel as usual (using nsichannel.asyncopen() in the common case) and write to the file in the ondataavailable
notifications.
... you may want to use nsisimplestreamlistener to simplify this task; to get progress
notifications, you can implement nsiprogresseventsink and set an interface requester as the notificationcallbacks of the channel that gives out such an event sink (this needs to be done before calling asyncopen).
Preference reference
in name including the top level domain is highlighted in the address bar by coloring it black and the other parts grey.browser.urlbar.trimurlsthe preference browser.urlbar.trimurls controls whether the protocol http and the trailing slash behind domain name (if the open page is exactly the domain name) are hidden.dom.event.clipboardevents.enableddom.event.clipboardevents.enabled lets websites get
notifications if the user copies, pastes, or cuts something from a web page, and it lets them know which part of the page had been selected.
...by default, the reader mode in firefox mobile is only enabled if the memory is greater than 384mb.ui.alertnotificationoriginui.alertnotificationorigin controls the position and direction from which popup
notifications invoked by nsialertsservice are sliding in.ui.spellcheckerunderlineui.spellcheckerunderline holds the colour which is used to underline words not recognized by the spellchecker.ui.spellcheckerunderlinestyleui.spellcheckerunderlinestyle holds the style which is used to underline words not recognized by the spellchecker.ui.textselectbackgroundui.textselectbackground saves the color in which the bac...
Retrieving part of the bookmarks tree
as long as the container is open, it will listen for
notifications from the bookmarks system to keep itself up-to-date.
...otherwise, it will continue to get observer
notifications and update itself, slowing down the whole browser.
Finishing the Component
ns_impl_isupports3(weblock, nsiobserver, iweblock, nsicontentpolicy); receiving
notifications to receive
notifications, you must register as a new category.
... "weblock", weblock_contractid, pr_true, pr_true, &previous); if (previous) nsmemory::free(previous); return rv; } this code adds a new category entry under the topic "content-policy," and it calls addcategoryentry in the same way we did in registering for
notifications.
Creating XPCOM components
methods creating an instance of your component weblock1.cpp using xpcom utilities to make things easier xpcom macros generic xpcom module macros common implementation macros declaration macros weblock2.cpp string classes in xpcom using strings nsembedstring and nsembedcstring smart pointers starting weblock getting called at startup registering for
notifications getting access to the category manager providing access to weblock creating the weblock programming interface defining the weblock interface in xpidl the xpidl syntax scriptable interfaces subclassing nsisupports the web locking interface implementing weblock declaration macros representing return values in xpcom xpidl code generation getting the weblock service ...
...ile manipulating files with nsifile using nsilocalfile for reading data processing the white list data iweblock method by method lock and unlock addsite removesite setsites getnext getsites hasmoreelements finishing the component using frozen interfaces copying interfaces into your build environment implementing the nsicontentpolicy interface receiving
notifications implementing the nsicontentpolicy uniform resource locators checking the white list creating nsiuri objects building the weblock ui user interface package list client code overview xul the xul document the locking ui site adding ui weblock.xul overlaying new user interface into mozilla weblockoverlay.xul other resources weblock.css image resou...
imgIRequest
cors_anonymous 2 cors_use_credentials 3 methods cancelandforgetobserver() cancels this request as in nsirequest.cancel(); further, also nulls out decoderobserver so it gets no further
notifications from us.
...aobserver will be notified synchronously (before the clone call returns) with all the
notifications that have already been dispatched for this image load.
mozIAsyncFavicons
this function does not send out
notifications that the data has changed.
...this function does not send out
notifications that the data has changed.
nsIAlertsService
note: since gecko 22, the
notifications are provided by firefox and have become platform-independent.
... see also alerts and
notifications bug 782211 - implement notification api spec ui.alertnotificationorigin [en-us] bug 1270819 - nsialertsservice showalertnotification sliding alert unnecessarily big / high ...
nsIAsyncStreamCopier
void asynccopy( in nsirequestobserver aobserver, in nsisupports aobservercontext ); parameters aobserver receives
notifications.
... aobservercontext the object to receive
notifications with information about the progress of the copy operation.
nsIContentPrefService
aobserver the name of an object implementing nsicontentprefobserver that will receive
notifications of changes to the preference's value.
... aobserver the name of the observer that will cease receiving
notifications of changes to the preference's value.
nsIDocShell
beginrestore() begin firing webprogresslistener
notifications for restoring a page presentation.
...finishrestore() finish firing webprogresslistener
notifications and dom events for restoring a page presentation.
nsIPlacesImportExportService
three nsiobserverservice
notifications are fired as a result of the import.
... three nsiobserverservice
notifications are fired as a result of the import.
nsIProgressEventSink
the channel will begin passing
notifications to the progress event sink after its asyncopen method has been called.
...
notifications will cease once the channel calls its listener's onstoprequest method or once the channel is canceled (via nsirequest.cancel()).
nsIPushService
} ); receiving push messages subscriptions created from privileged code use xpcom observer
notifications instead of service worker events.
... you can use the global nsiobserverservice to listen for these
notifications.
nsIWebBrowser
the chrome may optionally implement nsiinterfacerequestor, nsiwebbrowserchromefocus, nsicontextmenulistener and nsitooltiplistener to receive additional
notifications from the browser object.
...typically this method will be called to register an object to receive nsiwebprogresslistener or nsishistorylistener
notifications in which case the the iid is that of the interface.
nsIWifiMonitor
void startwatching( in nsiwifilistener alistener ); parameters alistener the nsiwifilistener object to receive
notifications when the wifi access point list changes.
...void stopwatching( in nsiwifilistener alistener ); parameters alistener the nsiwifilistener object to stop receiving
notifications on.
Index
the activity manager works in conjunction with the interactive status bar to give the user
notifications concerning what thunderbird is doing and how thunderbird has handled user requests.
...this may seem like a lot of infrastructure just to read messages from a flat file, but it allows us to do it asynchronously, and to have reading local messages fit into the same kind of mechanisms that reading nntp and imap messages do - running urls, getting onstart/stoprunningurl
notifications when the url starts/stops, etc.
Mozilla
using popup
notifications popup
notifications, also known as "doorhanger
notifications", are presented to notify the user of something that's important but may not need immediate attention.
... these non-modal
notifications let the user make decisions when they have a moment to do so, instead of being forced to deal with them at possibly inconvenient times.
Using the Frame Timing API - Web APIs
registering for
notifications after an observer is created, the next step is to use the performanceobserver.observe() method to specify the set of performance events to observe.
... in the following example, the observer only registers for "frame" performance entry
notifications.
Long Tasks API - Web APIs
usage var observer = new performanceobserver(function(list) { var perfentries = list.getentries(); for (var i = 0; i < perfentries.length; i++) { // process long task
notifications: // report back for analytics and monitoring // ...
... } }); // register observer for long task
notifications observer.observe({entrytypes: ["longtask"]}); // long script execution after this will result in queueing // and receiving "longtask" entries in the observer.
Media Session API - Web APIs
the media session api provides a way to customize media
notifications.
...the platform can show this metadata in media centers,
notifications, device lockscreens, etc.
MutationObserver.observe() - Web APIs
the mutationobserver method observe() configures the mutationobserver callback to begin receiving
notifications of changes to the dom that match the given options.
... in other words, until you've been notified that nodes are being split off from your monitored subtree, you'll get
notifications of changes to that split-off subtree and its nodes.
NotificationEvent - Web APIs
until(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); specifications specification status comment
notifications apithe definition of 'notificationevent' in that specification.
... note: this interface is specified in the
notifications api, but accessed through serviceworkerglobalscope.
Permissions API - Web APIs
concepts and usage historically different apis handle their own permissions inconsistently — for example the
notifications api allows for explicit checking of permission status and requesting permission, whereas the geolocation api doesn't (which causes problems if the user denied the initial permission request).
...notable apis that are permissions-aware include: clipboard api
notifications api push api web midi api more apis will gain permissions api support over time.
PushManager.permissionState() - Web APIs
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.
ServiceWorkerRegistration - Web APIs
serviceworkerregistration.get
notifications() returns a promise that resolves to an array of notification objects.
...
notifications api living standard adds the shownotification() method and the get
notifications() method.
Event reference
events can represent everything from basic user interactions to automated
notifications of things happening in the rendering model.
... notificationclick notificationevent
notifications apithe definition of 'onnotificationclick' in that specification.
Progressive loading - Progressive web apps (PWAs)
previous overview: progressive web apps in previous articles we covered apis that help us make our js13kpwa example a progressive web app: service workers, web manifests,
notifications and push.
... final thoughts that's all for this tutorial series — we went through the source code of the js13kpwa example app and learned about the use of progressive web apps features including an introduction, pwa structure, offline availability with service workers, installable pwas, and finally
notifications.
XUL Migration Guide - Archive of obsolete content
for example, if you have only imported the
notifications module, then even if a malicious web page manages to inject code into your add-on, it can't use the sdk's file module to access the user's data.
dev/panel - Archive of obsolete content
if an actor can send
notifications, as in the request/reply/notify pattern, then the corresponding volcan.js object emits an event, which you can listen for using addeventlistener.
platform/xpcom - Archive of obsolete content
for example, the add-on below implements the nsiobserver interface to listen for and log all topic
notifications: var { class } = require('sdk/core/heritage'); var { unknown } = require('sdk/platform/xpcom'); var { cc, ci } = require('chrome') var observerservice = cc['@mozilla.org/observer-service;1'].
Storing annotations - Archive of obsolete content
add the following to your add-on's main function: simplestorage.on("overquota", function () {
notifications.notify({ title: 'storage space exceeded', text: 'removing recent annotations'}); while (simplestorage.quotausage > 1) simplestorage.storage.annotations.pop(); }); because we use a notification to alert the user, we need to import the
notifications module: var
notifications = require("sdk/
notifications"); (it should be obvious that this is an incredibly unhelpful way to deal with ...
Developing for Firefox Mobile - Archive of obsolete content
high-level apis addon-page not supported base64 supported clipboard not supported context-menu not supported hotkeys supported indexed-db supported l10n supported
notifications supported page-mod supported page-worker supported panel not supported passwords supported private-browsing not supported querystring supported request supported selection not supported self supported simple-prefs supported simple-storage supported system...
Preferences - Archive of obsolete content
after it's garbage collected, you won't receive
notifications anymore, so use the provided examples above, and don't write something like the following code: // don't do this components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice) .getbranch("myextension.prefs.") .queryinterface(components.interfaces.nsiprefbranch2) .addobserver("", this, false); using prefhasuservalue() nsiprefbranch.pr...
Code snippets - Archive of obsolete content
xml file i/o code used to read, write and process files drag & drop code used to setup and handle drag and drop events dialogs code used to display and process dialog boxes alerts and
notifications modal and non-modal ways to notify users preferences code used to read, write, and modify preferences js xpcom code used to define and call xpcom components in javascript running applications code used to run other applications <canvas> related what wg canvas-related code signing a xpi how to sign an xpi with pki delayed execution performing background operations.
XUL School Tutorial - Archive of obsolete content
introduction introduction getting started with firefox extensions the essentials of an extension setting up a development environment javascript object management basic functionality adding menus and submenus adding toolbars and toolbar buttons adding events and commands adding windows and dialogs adding sidebars user
notifications and alerts intermediate functionality intercepting page loads connecting to remote content handling preferences local storage advanced topics the box model xpcom objects observer
notifications custom xul elements with xbl mozilla documentation roadmap useful mozilla community sites appendices appendix a: add-on performance appendix b: install and...
Adding preferences to an extension - Archive of obsolete content
var stockwatcher = { prefs: null, tickersymbol: "", // initialize the extension startup: function() { // register to receive
notifications of preference changes this.prefs = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice) .getbranch("extensions.stockwatcher2."); this.prefs.addobserver("", this, false); this.tickersymbol = this.prefs.getcharpref("symbol").touppercase(); this.refreshinformation(); window.setinterval(this.refreshinf...
Monitoring WiFi access points - Archive of obsolete content
tener = new test(); var wifi_service = components.classes["@mozilla.org/wifi/monitor;1"].getservice(components.interfaces.nsiwifimonitor); wifi_service.startwatching(listener); </script> </head> <body> <div id="d"><p></p></div> <div id="c"><p></p></div> </body> </html> the nsiwifilistener object the first thing the code above does is to prototype the listener object that will be receiving
notifications of changes to the access point list.
JavaScript Client API - Archive of obsolete content
getting your tracker to track changes in the underlying data is probably easiest to do if you register your tracker as an observer, so that it can receive
notifications from one or more mozilla components.
HTTP Class Overview - Archive of obsolete content
nshttphandler implements nsiprotocolhandler manages preferences owns the authentication cache holds references to frequently used services nshttpchannel implements nsihttpchannel talks to the cache initiates http transactions processes http response codes intercepts progress
notifications nshttpconnection implements nsistreamlistener & nsistreamprovider talks to the socket transport service feeds data to its transaction object routes progress
notifications nshttpconnectioninfo identifies a connection nshttptransaction implements nsirequest encapsulates a http request and response parses incoming data nshttpchunkeddecoder owned by a transaction strips chun...
Me - Archive of obsolete content
inside the function, this is the jetpack's content.function example jetpack.me.onfirstrun(function(){ jetpack.
notifications.show("oh boy, i'm installed!");}); ...
Simple Storage - Archive of obsolete content
this code persistently stores some data: jetpack.future.import("storage.simple");var mystorage = jetpack.storage.simple;mystorage.fribblefrops = [1, 3, 3, 7];mystorage.heimelfarbs = { bar: "baz" }; and this code -- pretend it's in the same jetpack as the code above -- simply uses that data: mystorage.fribblefrops.foreach(function (elt) console.log(elt));var bar = mystorage.heimelfarbs.bar;jetpack.
notifications.show(bar.baz); that's all there is to it!
UI - Archive of obsolete content
etpack content in a slide-out animated vertical column toolbar including entries and access elements into the toolbar panel a movable, expandable, and custom styled content element to display jetpack content tabs adding events and interacting with browser tabs and their contained documents statusbar low-level functions and basic calls
notifications a system for alerting users via provided ui mechanisms selection interacting with user-selected content window mitigates and eases interactions between different browser windows ...
Simple Storage - Archive of obsolete content
ode persistently stores some data: jetpack.future.import("storage.simple"); var mystorage = jetpack.storage.simple; mystorage.fribblefrops = [1, 3, 3, 7]; mystorage.heimelfarbs = { bar: "baz" }; and this code -- pretend it's in the same jetpack as the code above -- simply uses that data: mystorage.fribblefrops.foreach(function (elt) console.log(elt)); var bar = mystorage.heimelfarbs.bar; jetpack.
notifications.show(bar.baz); that's all there is to it!
Prism - Archive of obsolete content
this includes the ability to create desktop shortcuts, to place the application icon in the tray or dock and to display pop-up
notifications.
Methods - Archive of obsolete content
easepage insertitem insertitemat invertselection loadgroup loadonetab loadtabs loaduri loaduriwithflags makeeditable movebyoffset moveto movetoalertposition onsearchcomplete ontextentered ontextreverted openpopup openpopupatscreen opensubdialog openwindow preferenceforelement reload reloadalltabs reloadtab reloadwithflags removeallitems removeall
notifications removealltabsbut removecurrentnotification removecurrenttab removeitemat removeitemfromselection removenotification removeprogresslistener removesession removetab removetabsprogresslistener removetransient
notifications replacegroup reset rewind scrollbyindex scrollbypixels scrolltoindex select selectall selectitem selectitemrange selecttabatindex sets...
nsIContentPolicy - Archive of obsolete content
} // and this into your implementation file ns_impl_isupportsn(myclass, nsisupports, nsicontentpolicy, ...) note: before you can recieve
notifications, you must register your plugin with nsicategorymanager.
Using workers in extensions - Archive of obsolete content
let's take a look: startup: function() { // register to receive
notifications of preference changes this.prefs = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice) .getbranch("stockwatcher2."); this.prefs.queryinterface(components.interfaces.nsiprefbranch2); this.prefs.addobserver("", this, false); this.tickersymbol = this.prefs.getcharpref("symbol").touppercase(); this.worker = ...
Archived open Web documentation - Archive of obsolete content
browser feature detection an experimental approach to discovering degree of support for standards css obsolete css features displaying
notifications (deprecated) firefox offers support for "desktop
notifications"; these are
notifications that are displayed to the user outside the context of the web content, using the standard notification system provided by the operating system.
Common causes of memory leaks in extensions - Extensions
services.obs.removeobserver(myobserver, "private-browsing"); } in javascript code modules it recommended to also observe the xpcom-shutdown or quit-application
notifications and unregister your observers from that topic: var myobserver = { observe: function(subject, topic, data) { if (topic == "xpcom-shutdown") { services.obs.removeobserver(myobserver, "private-browsing"); services.obs.removeobserver(myobserver, "xpcom-shutdown"); } else { // do something with "private-browsing" } } }; services.obs.addobserver(myobserver, "priva...
Static method - MDN Web Docs Glossary: Definitions of Web-related terms
examples in the
notifications api, the notification.requestpermission() method is called on the actual notification constructor itself — it is a static method: let promise = notification.requestpermission(); the notification.close() method on the other hand, is an instance method — it is called on an specific notification object instance to close the system notification it represents: let mynotification = new notificat...
JavaScript object basics - Learn web development
as an example, the
notifications api — which allows modern browsers to fire system
notifications — requires you to instantiate a new object instance using the constructor for each notification you want to fire.
Accessibility API cross-reference
for receiving text input, see focused n/a armed armed available to javascript as document.activeelement indicates whether assistive technologies will present all, or only parts of, the changed region based on the change
notifications defined by the aria-relevant attribute.
Embedding API for Accessibility
l of the current keyboard focus frame */ no browse with caret setboolpref("accessibility.browsewithcaret", usecaret); /* if this pref is set, the caret will be visible in the text of the browser, allowing the user to cursor around the html content as if in a read-only editor */ moz 0.9 special content
notifications the w3c uaag specifies types of content that must be optional.
Application cache implementation overview
finished state is set when updated is 'finished' and is the last state the update transits to after invoking one of the final dom
notifications (onnoupdate, onupdaterady or onerror.) ...
Experimental features in Firefox
this api is used to customize the handling of media-related
notifications, to manage events and data useful for presenting a user interface for managing media playback, and to obtain media file metadata.
Message manager overview
this is the recommended way to load a script that executes just once per child process, which is something you might want to do if you are interacting with some global service (for example, adding listeners to observer
notifications or registering a content policy).
Process scripts
similarly, some observer
notifications must be registered in the content process, but if you do this in a frame script, and the frame script is loaded more than once, then you will get multiple
notifications for that event.
Message manager overview
this is the recommended way to load a script that executes just once per child process, which is something you might want to do if you are interacting with some global service (for example, adding listeners to observer
notifications or registering components).
Introduction to Layout in Mozilla
notifications passes these to the style set object, who in turn passes to the frame constructor frame constructor creates frames constructframeinternal recursively walks content tree, resolves style and creates frames either created by tag (<select>) or by display type (<p>) frame manager maintains mapping from content to frame style resolution compute stylistic inform...
AddonListener
these
notifications come in the form of calls to methods on the listener object.
Add-on Manager
for example: components.utils.import("resource://gre/modules/addonmanager.jsm"); addonmanager.getalladdons(function(aaddons) { // here aaddons is an array of addon objects }); // this code will execute before the code inside the callback
notifications about changes to installed add-ons are dispatched to any registered addonlisteners.
DownloadSummary
at this point, the removed view will not receive any more
notifications.
Downloads.jsm
observer
notifications (for example, "dl-done") and download listeners are replaced by views on the downloadlist object returned by the getlist() method.
Interfacing with the Add-on Repository
installing the add-on the shownotification() routine displays a notification box offering to install the recommended add-on, if one was found, or reports an error if the search failed: shownotification: function(prompt, button, installobj) { this.install = installobj; var box = popup
notifications.show(gbrowser.selectedbrowser, "sample-popup", prompt, null, /* anchor id */ { label: button, accesskey: "i", callback: function() { if (popup
notifications.install) { popup
notifications.install.install(); } else { popup
notifications.remove(box); } ...
dom.event.clipboardevents.enabled
dom.event.clipboardevents.enabled lets websites get
notifications if the user copies, pastes, or cuts something from a web page, and it lets them know which part of the page had been selected.
ui.alertNotificationOrigin
ui.alertnotificationorigin controls the position and direction from which popup
notifications invoked by nsialertsservice are sliding in.
L20n HTML Bindings
<script type="application/l10n-data+json"> { "new
notifications": 3, "user": { "name": "jane", "gender": "feminine" } } </script> this data will be available context-wide to all localized strings.
Necko Architecture
an nsistreamlistener is told when the uri transaction has "started," when data is available (in the case of reading data), and when it has "stopped." it is up to the nsistreamlistener implementation to decide what to do with these various
notifications.
JS_NewGlobalObject
debugger api hook during global creation, we fire
notifications to callbacks registered via the debugger api.
Accessing the Windows Registry Using XPCOM
you can read the interface documentation for a full explanation, but we will show only the three most commonly used modes here: access_read — for reading values, enumerating keys, and receiving
notifications access_write — for setting values and creating sub keys access_all — access for all operations in addition to open() and create(), there are the openchild() and createchild() methods.
Component Internals
once registration is complete and the
notifications have fired, xpcom is ready to be used by the application.
XPCOM guide
mozilla::services namespacethe services c++ namespace offers an easy and efficient alternative for obtaining a service as compared to the indirect xpcom approach: getservice(), callgetservice(), etc methods are expensive and should be avoided when possible.receiving startup
notificationssometimes it's necessary for xpcom components to receive
notifications as to the progress of the application's startup process, so they can start new services at appropriate times, for example.xpcom array guidemozilla has many array classes because each array is optimized for a particular usage pattern.
imgIContainer
aobserver observer to send animation
notifications to.
imgILoader
alistener a listener that you must send the channel's
notifications and data to.
mozIStorageConnection
acallback optional a mozistoragestatementcallback object to receive progress, error, and completion
notifications.
mozIStoragePendingStatement
note: for read statements, such as select, once you cancel the statement, you will receive no further
notifications about results.
mozIStorageStatement
the optional callback routine receives
notifications about the progress of the query.
mozIStorageStatementCallback
the mozistoragestatementcallback interface represents a callback handler that the storage api calls with result, error, and completion
notifications while handling asynchronous database queries.
nsICacheService
); obsolete since gecko 1.9.2 void evictentries(in nscachestoragepolicy storagepolicy); void init(); obsolete since gecko 1.8 void shutdown(); obsolete since gecko 1.8 void visitentries(in nsicachevisitor visitor); attributes attribute type description cacheiotarget nsieventtarget the event target for cache i/o operation
notifications.
nsIChannel
this is set by clients, who wish to provide a means to receive progress, status and protocol-specific
notifications.
nsIDOMGeoPositionErrorCallback
the nsidomgeopositionerrorcallback interface is used to represent an object that receives callback
notifications when geolocation errors occur.
nsIDocumentLoader
it is also responsible for sending nsiwebprogresslistener
notifications.
nsIFeed
1.0 66 introduced gecko 1.8 inherits from: nsifeedcontainer last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) attributes attribute type description cloud nsiwritablepropertybag2 the cloud element on a feed is used to identify the api endpoint of an rsscloud ping server, which distributes
notifications of changes to this feed.
nsIFrameMessageManager
an alternative method to listen for death of frame script is to use message-manager-disconnect observer: observer
notifications :: message manager.
nsIHttpActivityObserver
http transaction activity for activity
notifications of type activity_type_http_transaction, there are three activities that include extra data: activity_subtype_request_header aextrastringdata contains the text of the header.
nsIIdleService
most implementations need to poll the os for idle info themselves, meaning your
notifications could arrive with a delay up to the length of the polling interval in that implementation.
nsIMessageListenerManager
an alternative method to listen for death of frame script is to use a message-manager-disconnect observer; see observer
notifications :: message manager.
nsIMsgDatabase
addnewhdrtodb will send
notifications to any listeners.
nsIMsgFilterCustomAction
otherwise, be careful * that the action does correct
notifications to maintain counts, and correct * manipulations of both imap and local non-database storage of message * metadata.
nsIPrintingPrompt
webprogresslistener additional listener can be registered for progress
notifications.
nsIPrivateBrowsingService
changing this value while handling one of the
notifications generated by the private browsing service throws an ns_error_failure exception.
nsISHistoryListener
docshell/shistory/public/nsishistorylistener.idlscriptable an interface you can implement to receive
notifications about activities that occur in session history, and optionally cancel them.
nsISmsRequestManager
nsismsrequestmanager dom/sms/interfaces/nsismsrequestmanager.idlscriptable used to manage sms related requests and
notifications for the websms api 1.0 66 introduced gecko 13.0 inherits from: nsisupports last changed in gecko 15.0 (firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) implemented by: @mozilla.org/sms/smsrequestmanager;1.
nsITextInputProcessorCallback
dom/interfaces/base/nsitextinputprocessor.idlscriptable a callback interface for nsitextinputprocessor user 1.0 66 introduced gecko 38 inherits from: nsisupports last changed in gecko 38.0 (firefox 38.0 / thunderbird 38.0 / seamonkey 2.35) nsitextinputprocessorcallback is defined for receiving requests and
notifications to ime from gecko.
nsIThreadPool
a listener will only receive
notifications about threads created after the listener is set so it is recommended that the consumer set the listener before dispatching the first event.
nsIThreadPoolListener
the nsithreadpoollistener interface represents objects that listen to
notifications generated by the nsithreadpool.
nsIUpdatePrompt
toolkit/mozapps/update/nsiupdateservice.idlscriptable this interface describes an object that can be used to show various update-related
notifications to the user.
nsIWebBrowserPersist
progresslistener nsiwebprogresslistener callback listener for progress
notifications.
nsIWifiListener
netwerk/wifi/nsiwifilistener.idlscriptable this interface is implemented by clients interested in receiving
notifications when the list of available wifi access points changes.
nsIWindowWatcher
note that there is no interface for such
notifications (not a public one, anyway).
nsIWorker
method overview void postmessage(in domstring amessage, [optional] in nsiworkermessageport amessageport); attributes attribute type description onmessage nsidomeventlistener an object to receive
notifications when messages are received on the worker's message port.
nsIZipWriter
void processqueue( in nsirequestobserver aobserver, in nsisupports acontext ); parameters aobserver the observer to receive
notifications from the queue.
Storage
both of these methods have similar signatures that accept an object as input that receives
notifications the execution of the statement(s).
The Thread Manager
nsithreadobserver provides the ability to monitor a thread, to receive
notifications when events are dispatched to it and when they're finished being processed.
XPCOM
this guide provides some explanation and advice on how to choose between them.observer
notificationsthe following are topics that you can observe during the course of an application.
Mail and RDF
there are times (for example, from javascript/xul) where we want folder
notifications that have nothing to do with rdf.
Mailbox
this may seem like a lot of infrastructure just to read messages from a flat file, but it allows us to do it asynchronously, and to have reading local messages fit into the same kind of mechanisms that reading nntp and imap messages do - running urls, getting onstart/stoprunningurl
notifications when the url starts/stops, etc.
Filter Incoming Mail
by example, setting it to lower case subject = subject.tolocalelowercase(); // then we rebuild a subject objet by rencoding the string // and assign it to the message headers and we're done amsghdr.subject = mimeconvert.encodemimepartiistr_utf8(subject, false, "utf-8", 0, 72); } } }; function init() { var
notificationservice = components.classes["@mozilla.org/messenger/msg
notificationservice;1"] .getservice(components.interfaces.nsimsgfolder
notificationservice);
notificationservice.addlistener(newmaillistener,
notificationservice.msgadded); } addeventlistener("load", init, true); have a look to nsimsgdbhdr to get the full list of properties to be modified.
Using js-ctypes
.long; var void = ctypes.void_t; var __cfstring = new ctypes.structtype("__cfstring"); var cfstringref = __cfstring.ptr; var __cfurl = new ctypes.structtype("__cfurl"); var cfurlref = __cfurl.ptr; var __cfallocator = new ctypes.structtype("__cfallocator"); var cfallocatorref = __cfallocator.ptr; var unichar = ctypes.jschar; // uint16 with automatic conversion // define constants var kcfuser
notificationstopalertlevel = 0; var kcfusernotificationnotealertlevel = 1; var kcfusernotificationcautionalertlevel = 2; var kcfusernotificationplainalertlevel = 3; // declare functions /* https://developer.apple.com/library/mac/documentation/corefoundation/reference/cfusernotificationref/index.html#//apple_ref/c/func/cfusernotificationdisplaynotice * sint32 cfusernotificationdisplaynotice ( * cftimeinter...
IDBDatabase.transaction() - Web APIs
for a complete example, see our to-do
notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBDatabase - Web APIs
for a complete working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the idbdatabase object, // when the database is opened successfully, or not dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>data...
IDBFactory.open() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var note = document.queryselector("ul"); // in the following line, you should include the prefixes // of implementations you want to test.
IDBFactory - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // in the following line, you should include the prefixes of implementations you want to test.
IDBObjectStore.add() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBObjectStore.autoIncrement - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBObjectStore.clear() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBObjectStore.createIndex() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // two event handlers for opening the database.
IDBObjectStore.delete() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBObjectStore.deleteIndex() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being opened successfully, or not dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</l...
IDBObjectStore.get() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBObjectStore.indexNames - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBObjectStore.keyPath - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBObjectStore.name - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBObjectStore.put() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) const title = "walk dog"; // open up a transaction as usual const objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title const objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = () => { // grab the data object returned as the result const dat...
IDBObjectStore.transaction - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBObjectStore - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in db.
IDBOpenDBRequest - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these event handlers act on the database being opened.
IDBRequest.error - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var title = "walk dog"; // open up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the do-do list with the specified title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitl...
IDBRequest.onerror - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var title = "walk dog"; // open up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data =...
IDBRequest.onsuccess - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var title = "walk dog"; // open up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data =...
IDBRequest.readyState - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var title = "walk dog"; // open up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data =...
IDBRequest.result - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var title = "walk dog"; // open up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data =...
IDBRequest.source - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var title = "walk dog"; // open up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as its title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = ...
IDBRequest.transaction - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var title = "walk dog"; // open up a transaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that has this title as it's title var objectstoretitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data =...
IDBRequest - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being // opened successfully, or not dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.
IDBTransaction.abort() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBTransaction.db - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBTransaction.error - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBTransaction.mode - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBTransaction.objectStore() - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBTransaction.onabort - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBTransaction.oncomplete - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBTransaction.onerror - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBTransaction - Web APIs
for a full working example, see our to-do
notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db // variable.
IDBVersionChangeEvent.newVersion - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var note = document.queryselector("ul"); // in the following line, you should include the prefixes of // implementations you want to test.
IDBVersionChangeEvent - Web APIs
for a full working example, see our to-do
notifications app (view example live.) var note = document.queryselector("ul"); // in the following line, you should include the prefixes of implementations you want to test.
Using IndexedDB - Web APIs
at least with the addition of the abort
notifications and idbdatabase.onclose, you can know when this has happened.
IndexedDB API - Web APIs
to-do
notifications (view example live): the reference application for the examples in the reference docs.
MediaQueryList - Web APIs
the resulting object handles sending
notifications to listeners when the media query state changes (i.e.
MediaQueryListListener - Web APIs
a mediaquerylist object maintains a list of media queries on a document, and handles sending
notifications to listeners when the media queries on the document change.
Navigator - Web APIs
navigator.webkitnotification returns a notification object you can use to deliver
notifications to the user from your web application.
Notification.Notification() - Web APIs
function spawnnotification(thebody,theicon,thetitle) { var options = { body: thebody, icon: theicon } var n = new notification(thetitle,options); } specifications specification status comment
notifications apithe definition of 'notification() constructor' in that specification.
Notification.body - Web APIs
examples function spawnnotification(thebody, theicon, thetitle) { var options = { body: thebody, icon: theicon } var n = new notification(thetitle, options); console.log(n.body); } specifications specification status comment
notifications apithe definition of 'body' in that specification.
Notification.data - Web APIs
var options = { body: 'do you like my body?', data: 'i like peas.' } var n = new notification('test notification',options); console.log(n.data) // should return 'i like peas.' specifications specification status comment
notifications apithe definition of 'data' in that specification.
Notification.dir - Web APIs
var options = { body: 'do you like my body?', dir: 'rtl' } var n = new notification('test notification',options); console.log(n.dir) // should return 'rtl' specifications specification status comment
notifications apithe definition of 'dir' in that specification.
Notification.icon - Web APIs
var notification = new notification('to do list', { body: text, icon: img }); specifications specification status comment
notifications apithe definition of 'icon' in that specification.
Notification.lang - Web APIs
var options = { body: 'do you like my body?', lang: 'en-us' } var n = new notification('test notification',options); console.log(n.lang) // should return 'en-us' specifications specification status comment
notifications apithe definition of 'lang' in that specification.
Notification.maxActions - Web APIs
const maxactions = notification.maxactions; console.log('this device can display at most ' + maxactions + ' actions on each notification.'); specifications specification status comment
notifications api living standard living standard ...
Notification.onclick - Web APIs
we use an onclick handler to open a webpage in a new tab (specified by the inclusion of the '_blank' parameter) once a notification is clicked: notification.onclick = function(event) { event.preventdefault(); // prevent the browser from focusing the notification's tab window.open('http://www.mozilla.org', '_blank'); } specifications specification status comment
notifications apithe definition of 'onclick' in that specification.
Notification.renotify - Web APIs
var options = { body: 'do you like my body?', renotify: true } var n = new notification('test notification',options); console.log(n.renotify) // should log true specifications specification status comment
notifications apithe definition of 'renotify' in that specification.
Notification.silent - Web APIs
var options = { body: 'do you like my body?', silent: true } var n = new notification('test notification', options); console.log(n.silent) // should log true specifications specification status comment
notifications apithe definition of 'silent' in that specification.
Notification.timestamp - Web APIs
var dts = math.floor(date.now()); var options = { body: 'do you like my body?', timestamp: dts } var n = new notification('test notification',options); console.log(n.timestamp) // should log original timestamp specifications specification status comment
notifications apithe definition of 'timestamp' in that specification.
Notification.title - Web APIs
examples function spawnnotification(thebody,theicon,thetitle) { var options = { body: thebody, icon: theicon } var n = new notification(thetitle,options); console.log(n.title) } specifications specification status comment
notifications apithe definition of 'title' in that specification.
Notification.vibrate - Web APIs
var options = { body: 'do you like my body?', vibrate: [200, 100, 200] } var n = new notification('test notification',options); console.log(n.vibrate) // should log [200,100,200] specifications specification status comment
notifications apithe definition of 'vibrate' in that specification.
NotificationEvent.NotificationEvent() - Web APIs
example var n = new notification('hello'); var init = { notification: n }; var mynotificationevent = new notificationevent(type, init); specifications specification status comment
notifications apithe definition of 'notificationevent() constructor' in that specification.
NotificationEvent.action - Web APIs
self.registration.shownotification("new articles available", { actions: [{action: "get", title: "get now."}] }); self.addeventlistener('notificationclick', function(event) { event.notification.close(); if (event.action === 'get') { synchronizereader(); } else { clients.openwindow("/reader"); } }, false); specifications specification status comment
notifications apithe definition of 'action' in that specification.
NotificationEvent.notification - Web APIs
until(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); specifications specification status comment
notifications apithe definition of 'notification' in that specification.
Permissions - Web APIs
opera android full support 30safari ios no support nosamsung internet android full support 4.0
notifications permissionchrome full support 43edge full support 79firefox ?
Using the Permissions API - Web APIs
historically, different apis handle their own permissions inconsistently — for example the
notifications api allows for explicit checking of permission status and requesting permission, whereas the geolocation api doesn't (which causes problems if the user denied the initial permission request, as we'll see below).
PushManager.subscribe() - Web APIs
} ); }); responding to user gestures subscribe() calls should be done in response to a user gesture, such as clicking a button, for example: btn.addeventlistener('click', function() { serviceworkerregistration.pushmanager.subscribe(options) .then(function(pushsubscription) { // handle subscription }); }) this is not only best practice — you should not be spamming users with
notifications they didn't agree to — but going forward browsers will explicitly disallow
notifications not triggered in response to a user gesture.
PushManager - Web APIs
the pushmanager interface of the push api provides a way to receive
notifications from third-party servers as well as request urls for push
notifications.
Resize Observer API - Web APIs
the resize observer api provides a performant mechanism by which code can monitor an element for changes to its size, with
notifications being delivered to the observer each time the size changes.
ServiceWorkerGlobalScope: notificationclick event - Web APIs
event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }; specifications specification status
notifications apithe definition of 'onnotificationclick' in that specification.
StorageManager.estimate() - Web APIs
this variance is based on factors such as: how often the user visits public site popularity data user engagement signals like bookmarking, adding to homescreen, or accepting push
notifications example in this example, we obtain the usage estimates and present the percentage of storage capacity currently used to the user.
WorkerNavigator.permissions - Web APIs
examples self.navigator.permissions.query({name:'
notifications'}).then(function(result) { if (result.state === 'granted') { shownotification(); } else if (result.state === 'prompt') { requestnotificationpermission() } }); specification specification status comment permissions working draft initial definition.
Web APIs
information api ppage visibility apipayment request apiperformance apiperformance timeline apipermissions apipointer eventspointer lock apiproximity events push api rresize observer apiresource timing apisserver sent eventsservice workers apistoragestorage access apistreams ttouch eventsuurl apivvibration apivisual viewport wweb animationsweb audio apiweb authentication apiweb crypto apiweb
notificationsweb storage apiweb workers apiwebglwebrtcwebvttwebxr device apiwebsockets api interfaces this is a list of all the interfaces (that is, types of objects) that are available.
Demos of open web technologies
n garden css floating logo "mozilla" paperfold css blockout rubik's cube pure css slides planetarium (source code) loader with blend modes text reveal with clip-path ambient shadow with custom properties luminiscent vial css-based single page application (source code) transformations impress.js (source code) games ioquake3 (source code) kai 'opua (source code) web apis
notifications api html5
notifications (source code) web audio api web audio fireworks oscope.js - javascript oscilloscope html5 web audio showcase (source code) html5 audio visualizer (source code) graphical filter editor and visualizer (source code) file api slide my text - presentation from plain text files web workers web worker fractals photo editor coral generator raytracer ho...
Index - Event reference
events can represent everything from basic user interactions to automated
notifications of things happening in the rendering model.
Guide to Web APIs - Developer guides
information api ppage visibility apipayment request apiperformance apiperformance timeline apipermissions apipointer eventspointer lock apiproximity events push api rresize observer apiresource timing apisserver sent eventsservice workers apistoragestorage access apistreams ttouch eventsuurl apivvibration apivisual viewport wweb animationsweb audio apiweb authentication apiweb crypto apiweb
notificationsweb storage apiweb workers apiwebglwebrtcwebvttwebxr device apiwebsockets api ...
CSP: report-uri - HTTP
"\n\nfurther cps violations will be logged to the following log file, but no further email
notifications will be sent until this log file is deleted:\n\n" .
Link prefetching FAQ - HTTP
from this, we receive document start & stop
notifications, and we approximate idle time as the period between the last document stop and the next document start.