Enable installing app as pwa
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<html lang="<%= I18n.locale %>">
|
||||
<head>
|
||||
<title><%= content_for?(:title) ? yield(:title) : "Terminator" %></title>
|
||||
<link rel="manifest" crossorigin="use-credentials" href="/manifest.json" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Terminator</title>
|
||||
<link rel="manifest" crossorigin="use-credentials" href="/manifest.json" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
|
||||
21
app/views/service_worker/manifest.json.erb
Normal file
21
app/views/service_worker/manifest.json.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"short_name": "Zdravo Stopalo",
|
||||
"name": "Zdravo Stopalo",
|
||||
"icons": [
|
||||
{
|
||||
"src": "<%= image_path('icon-192.png')%>",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "<%= image_path('icon-512.png')%>",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": "<%= root_path %>",
|
||||
"background_color": "#FFFFFF",
|
||||
"display": "standalone",
|
||||
"scope": "<%= root_path %>",
|
||||
"theme_color": "#8e2731"
|
||||
}
|
||||
14
app/views/service_worker/service_worker.js
Normal file
14
app/views/service_worker/service_worker.js
Normal file
@@ -0,0 +1,14 @@
|
||||
function onInstall(event) {
|
||||
console.log("[Serviceworker]", "Installing!", event);
|
||||
}
|
||||
|
||||
function onActivate(event) {
|
||||
console.log("[Serviceworker]", "Activating!", event);
|
||||
}
|
||||
|
||||
function onFetch(event) {
|
||||
console.log("[Serviceworker]", "Fetching!", event);
|
||||
}
|
||||
self.addEventListener("install", onInstall);
|
||||
self.addEventListener("activate", onActivate);
|
||||
self.addEventListener("fetch", onFetch);
|
||||
Reference in New Issue
Block a user