JavaScript – Simple Progressive Web Application

Tomorrow I will be visiting the HackConf at Sofia, Bulgaria. Thus, today I was part of a workshop for Progressive Web Applications and I will try to summarize how to build an application, which simply displays something like the Facebook messenger below:

notificationFirst it asks politely, whether it is allowed to give notifications and then it gives these upon an event:

notification2

So, let’s start from the very beginning – what do you need to run something as simple as this?

  • Node.js
  • Npm and the command npm install in the console
  • Then a simple button with an id in an index.html file
  • A server worker file, looking like this:

  • A main.js file, looking like this:

Cheers! 🙂