Browser Technologies || Progressive Enhancing Notifications

use case: I would like to be notified when my team scores or wins. View the Demo: demo on github pages

The problem

A user wishes to be notified of update during a game. The user would like to see this in a web browser. User can browse with multiple browsers, whereas every browser has a different support of features needed for this task. It can also occur that the user defers to another browser tab or window, this will result in the need of a ‘blind’ notification.

My fix

Core functionality

The core will contain the following functionality:

notes: For this demo i will have static notification page data. In production u could catch the users choice server side and render that notification dynamic

Enhancement stage 1

To enhance the core we will add the following functionality:

Enhancement stage 2

To enhance the styled pages we will add the following functionality:

note: Client sided JS needed. The user wont notice anything when in a different browser

Enhancement stage 3

To enhance the in page notification we will add the following functionality:

note: Client needs to be able to handle javascript Audio

Enhancement stage 4

To enhance the sound and tabTitle we will add the following functionality:

note: Client needs to be able to handle Notification API

The <code>

To make the code I needed the following basics:

Choose your team
- Notification 'template'

Your Team has scored

team-logo

Final Score

2 - 1

close
- Audio web API

const snd = new Audio(‘file.wav’); snd.play();

- Browser title adjusting
document.hidden
? document.title = (1) ${document.title}
null;
- Notification web API

new Notification(title, { options }); ```

Cloning

Cloning:

$ cd ~/Sites/ && git clone git@github.com:IanCStewart/minor-bt.git

Get the node modules:

$ cd minor-bt/ && npm i

Building and Deployment

Build the build.js file: $ npm run build or $ npm run build-minified

Run on localhost:

$ npm start

Terminal should return something like this:

[BS] Access URLs:
 -----------------------------------
 Local: http://localhost:3000
 External: http://145.28.151.74:3000
 -----------------------------------