# Evaluating Progressive Web App Accessibility for People with Disabilities
## 3 Progressive Web Apps (PWAs)
### Service Workers  
A service worker is a set of APIs introduced by PWA, running in its own thread and providing generic entry points for event-driven background processing that allows developers to programmatically cache and preload assets and data and manage push notifications, among other things [11]. More specifically, a service worker is a JavaScript script that runs in the background of the application, deploying in a separate thread from the UI, thereby avoiding app freezing. It acts as an intermediary between the app and the internet [4], and its main purpose is to execute functions as \"promises\" in a specific order, sending results back to the app. A JS Promise is an asynchronous managing mechanism that enables programmers to chain asynchronous computations while supporting proper error-handling methods [12]. Promises technically fix the gap between function execution order by telling the asynchronous method that it \"promises\" to call a given function as soon as the asynchronous (async) function is finished. An alternative method to promises is the callbacks. As regards the callbacks, the executing function knows in advance what has to be done when the asynchronous task has been completed. In promises, instead, the executing function returns an object (the promise), in which we describe what it has to do when the asynchronous task has been completed. A general approach is that the callbacks follow a more functional way of programming, instead of promises following a more object-oriented way.  
Before service workers, the legacy technology called \"AppCache\" was the one that provided users an offline experience on the web. Although \"AppCache API\" was a straightforward solution to the offline experience, it faces a lot of issues that service workers avoid, such as caching all pages by default whether they have changed or not.  
A service worker, as a middle service, is vulnerable to cross-site scripting (XSS) attacks, and a secure connection is, thus, required [13]. In addition, service workers have the power to provide async capabilities to an app, such as periodic sync, and act similarly to a cronjob performing specific actions at a certain date or time.  
To set up a functional service worker, three main actions must be implemented: registration, installation, and activation. Through an on-page load, service workers must check for browser compatibility. Then, using the \"serviceWorkerRegistration\" function, the installation starts as a promise [14], where the install and activate \"AddEventListener\" functions follow a specific procedure to install and activate the service workers. The process followed by developers to set up a service worker is presented in Figure 2.  
Modern web browsers have adopted the use of service workers, and others support them in their latest versions. Supported web browsers are Chrome, Firefox, Opera, Safari, IE, and Samsung Internet. These browsers also support features such as promises; navigator.serviceWorker; and fetch, install, and activate events. In contrast, background sync is currently only supported in Chrome [15]. According to Google's Web Updates in 2015, back  
Figure 2: Service worker’s lifecycle.  
ground sync is a web API that lets you defer actions until the user has stable connectivity. This is useful for ensuring that whatever the user wants to send is actually sent.