{"version":3,"sources":["notifyMe.js","notifyMeInServiceWorker.js","index.js"],"names":["spawnNotification","theBody","theTitle","Notification","body","icon","module","exports","window","permission","requestPermission","alert","spawnNotificationOnTheSW","registration","title","options","showNotification","subscribe","navigator","serviceWorker","ready","then","serviceWorkerRegistration","pushManager","subscription","sendSubscriptionToServer","subscribeButton","disabled","catch","error","console","log","register","err","notifyMe","require","notifyMeInServiceWorker","result"],"mappings":";AA4BA,SAASA,EAAkBC,EAAQC,GAM1B,IAAIC,aAAaD,EALX,CACbE,KAAMH,EAENI,KAAM,kEAhCRC,OAAOC,QAAU,WAEV,iBAAkBC,OAKa,YAA5BL,aAAaM,WAErBT,EAAkB,YACjB,iCAKmC,WAA5BG,aAAaM,YACrBN,aAAaO,kBAAkB,SAAUD,GAErB,YAAfA,GACHT,EAAkB,YACjB,mCAjBHW,MAAM;;ACoBR,SAASC,EAAyBC,EAAcT,EAAKU,GAChDC,IAAAA,EAAU,CACbX,KAAMA,EAENC,KAAM,iEAEPQ,EAAaG,iBAAiBF,EAAOC,GAGtC,SAASE,IACRC,UAAUC,cAAcC,MAAMC,KAAK,SAASC,GAC1CA,EAA0BC,YAAYN,YACtCI,KAAK,SAASG,GAGNC,OADPC,gBAAgBC,UAAW,EACpBF,yBAAyBD,KAEjCI,MAAM,SAASC,GACkB,WAA5B1B,aAAaM,YAClBqB,QAAQC,IAAI,2CACZL,gBAAgBC,UAAW,IAE3BG,QAAQC,IAAI,+BAAgCF,GAC5CH,gBAAgBC,UAAW,OA9C9BrB,OAAOC,QAAU,WACZ,kBAAmBW,WAGtBA,UAAUC,cACRa,SAAS,wCACTX,KAAK,SAAAR,GACDV,GAA4B,YAA5BA,aAAaM,WAA0B,CAM1CS,UAAUC,cAAcC,MAAMC,KAAK,SAASR,GAC3CD,EAAyBC,EAAc,YACtC,4DAKHe,MAAM,SAAAK,GAAOH,OAAAA,QAAQC,IAAI;;ACpB7B,IAAMG,EAAWC,QAAQ,cACnBC,EAA0BD,QAAQ,6BACxChC,aAAaO,oBAAoBW,KAAK,SAASgB,GAC9CP,QAAQC,IAAIM,GACZD","file":"1014b3c2.0223743f.map","sourceRoot":"..","sourcesContent":["module.exports = function notifyMe() {\n\t// Let's check if the browser supports notifications\n\tif (!(\"Notification\" in window)) {\n\t\talert(\"This browser does not support system notifications\");\n\t}\n\n\t// Let's check whether notification permissions have already been granted\n\telse if (Notification.permission === \"granted\") {\n\t\t// If it's okay let's create a notification\n\t\tspawnNotification(\"Hi there!\",\n\t\t\t\"Calling you from Buenos Aires\",\n\t\t);\n\t}\n\n\t// Otherwise, we need to ask the user for permission\n\telse if (Notification.permission !== 'denied') {\n\t\tNotification.requestPermission(function (permission) {\n\t\t\t// If the user accepts, let's create a notification\n\t\t\tif (permission === \"granted\") {\n\t\t\t\tspawnNotification(\"Hi there!\",\n\t\t\t\t\t\"Calling you from Buenos Aires\",\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\t// Finally, if the user has denied notifications and you\n\t// want to be respectful there is no need to bother them any more.\n}\nfunction spawnNotification(theBody,theTitle) {\n\tvar options = {\n\t\tbody: theBody,\n\t\t// stack overflow icon\n\t\ticon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',\n\t}\n\tvar n = new Notification(theTitle, options);\n}","module.exports = function notifyMeInServiceWorker() {\n\tif (\"serviceWorker\" in navigator) {\n\n\t\t// Use the window load event to keep the page load performant\n\t\tnavigator.serviceWorker\n\t\t\t.register(\"./sw.js\")\n\t\t\t.then(registration => {\n\t\t\t\tif (Notification.permission === \"granted\") {\n\t\t\t\t\tvar options = {\n\t\t\t\t\t\tbody: \"theBody\",\n\t\t\t\t\t\t// stack overflow icon\n\t\t\t\t\t\ticon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',\n\t\t\t\t\t}\n\t\t\t\t\tnavigator.serviceWorker.ready.then(function(registration) {\n\t\t\t\t\t\tspawnNotificationOnTheSW(registration, \"Hi there!\",\n\t\t\t\t\t\t\t\"Calling you from the service worker on Buenos Aires\",\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(err => console.log(\"failed to register service worker!\"));\n\t}\n}\nfunction spawnNotificationOnTheSW(registration, body,title) {\n\tvar options = {\n\t\tbody: body,\n\t\t// stack overflow icon\n\t\ticon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',\n\t}\n\tregistration.showNotification(title, options);\n}\n\nfunction subscribe() {\n\tnavigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {\n\t  serviceWorkerRegistration.pushManager.subscribe()\n\t\t.then(function(subscription) {\n\t\t  // The subscription was successful\n\t\t  subscribeButton.disabled = true;\n\t\t  return sendSubscriptionToServer(subscription);\n\t\t})\n\t\t.catch(function(error) {\n\t\t  if (Notification.permission === 'denied') {\n\t\t\tconsole.log('Permission for Notifications was denied');\n\t\t\tsubscribeButton.disabled = true;\n\t\t  } else {\n\t\t\tconsole.log('Unable to subscribe to push.', error);\n\t\t\tsubscribeButton.disabled = false;\n\t\t  }\n\t\t});\n\t});\n  }","const notifyMe = require(\"./notifyMe\");\nconst notifyMeInServiceWorker = require(\"./notifyMeInServiceWorker\")\nNotification.requestPermission().then(function(result) {\n\tconsole.log(result);\n\tnotifyMeInServiceWorker();\n});\n"]}