Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

service worker

service worker is javascript file that run every time.It keeps running even you
close the browser.Due to this we can send push notification,offline mode.
//Register our service worker in index.html
<script>
  if('serviceWorker' in navigator){
  window.addEventListener('load', ()=> {
    //registering of serviceWorker.
  navigator.serviceWorker('./serviceworker.js')
  .then((reg)=> console.log("Success:", reg.scope));
  .catch((err)=> console.log("Failure: ", err));
  })}
 <script>
  
everything ok then we will see Sucess: localhost:3000 in console of browser

Comment

how to create a worker service

//Step 1: Publish the Worker service

cd "Path to the Worker service project"
dotnet restore
dotnet publish -o PathToThePublishFolder

//Step 2: Deploy and start with sc utility

sc.exe create DemoWorker binpath= PathToThePublishFolderYourWorkerClassName.exe
sc.exe start YourWorkerClassName

//Step 3: Stop and delete with sc utility

sc.exe stop YourWorkerClassName 
sc.exe delete YourWorkerClassName 
Comment

service worker

const filter = {
  url: [
    {
      urlMatches: 'https://www.google.com/',
    },
  ],
};

chrome.webNavigation.onCompleted.addListener(() => {
  console.info("The user has loaded my favorite website!");
}, filter);
Comment

PREVIOUS NEXT
Code Example
Shell :: nano show line numbers 
Shell :: react redux install 
Shell :: npm checkup 
Shell :: query in github api 
Shell :: mac terminal wifi commands 
Shell :: check difference between two branches git 
Shell :: anaconda for ubuntu 18.04 
Shell :: LINUX STRING TO UPPERCASE 
Shell :: linux grep regex return match 
Shell :: install macos on vmware ubuntu 
Shell :: docker logs path 
Shell :: ssh public key 
Shell :: or create a new repository on the command line 
Shell :: how to get driver information ubuntu 
Shell :: git initialize 
Shell :: git liste branches 
Shell :: apt upgrade full 
Shell :: sed multiple files 
Shell :: sveltekit with tailwindcss 
Shell :: scp command in unix 
Shell :: how to set environment variables in linux 
Shell :: dracula theme gnome terminal 
Shell :: touch linux 
Shell :: dir files 
Shell :: ppm to ppb 
Shell :: installing helm on linux 
Shell :: what does %! mean vim 
Shell :: poetry create requirements.txt python 
Shell :: wsl lost internet connection 
Shell :: linux find file type under a specific folder 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =