“Pracownik usług” Kod odpowiedzi

Jak utworzyć usługę pracowniczą

//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

Pracownik usług

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

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

Odpowiedzi podobne do “Pracownik usług”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu