“Servicearbeiter” Code-Antworten

So erstellen Sie einen Arbeiterservice

//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= PathToThePublishFolder\YourWorkerClassName.exe
sc.exe start YourWorkerClassName

//Step 3: Stop and delete with sc utility

sc.exe stop YourWorkerClassName 
sc.exe delete YourWorkerClassName 
ozioma ene

Service Worker.js

if ('serviceWorker' in navigator) {  window.addEventListener('load', function() {    navigator.serviceWorker.register('/sw.js').then(function(registration) {      // Registration was successful      console.log('ServiceWorker registration successful with scope: ', registration.scope);    }, function(err) {      // registration failed :(      console.log('ServiceWorker registration failed: ', err);    });  });}
Tough Trout

Servicearbeiter

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

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

Ähnliche Antworten wie “Servicearbeiter”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen