fiddling around with push notifications
This commit is contained in:
		
							
								
								
									
										26
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								main.js
									
									
									
									
									
								
							| @ -17,28 +17,4 @@ var sidebar = new Sidebar(create_game_container, setting_container, control_cont | |||||||
| window.addEventListener("resize", function() { | window.addEventListener("resize", function() { | ||||||
|     var tilesize = getComputedStyle(document.body).getPropertyValue("--tile-size"); |     var tilesize = getComputedStyle(document.body).getPropertyValue("--tile-size"); | ||||||
|     grid.on_screen_orientation_change(tilesize, tilesize); |     grid.on_screen_orientation_change(tilesize, tilesize); | ||||||
| }); | }) | ||||||
|  |  | ||||||
| window.addEventListener('notificationclick', function(event) { |  | ||||||
|     event.waitUntil(async function() { |  | ||||||
|         const allClients = await clients.matchAll({ |  | ||||||
|             includeUncontrolled: true |  | ||||||
|         }); |  | ||||||
|  |  | ||||||
|         var instance = None; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         // Let's see if we already have a window open: |  | ||||||
|         for (const client of allClients) { |  | ||||||
|             client.focus(); |  | ||||||
|             instance = client; |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         // If we didn't find an existing window, |  | ||||||
|         // open a new one: |  | ||||||
|         if (!instance) { |  | ||||||
|             instance = await clients.openWindow(rel_home); |  | ||||||
|         } |  | ||||||
|     }()); |  | ||||||
| }); |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user