Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Duvidas no conteudo criado automaticamente

Quando eu criei o projeto seguindo as aulas do curso apareceu dois arquivos juntos com o index.html esses arquivos sao :

service-worker.js

self.addEventListener('activate', function (event) {

});

self.addEventListener('fetch', function (event) {

});

self.addEventListener('push', function (event) {

});

manifest.json

{
  "name": "My Ionic App",
  "short_name": "My Ionic App",
  "start_url": "index.html",
  "display": "standalone",
  "icons": [{
    "src": "icon.png",
    "sizes": "512x512",
    "type": "image/png"
  }]
}

o que são esses arquivos ?

2 respostas

meu index.html foi criado automaticamente pelo ionic desse jeito :

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link rel="manifest" href="manifest.json">

    <!-- un-comment this code to enable service worker
    <script>
      if ('serviceWorker' in navigator) {
        navigator.serviceWorker.register('service-worker.js')
          .then(() => console.log('service worker installed'))
          .catch(err => console.log('Error', err));
      }
    </script>-->

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>
  </head>
  <body ng-app="starter">

    <ion-pane>
      <ion-header-bar class="bar-stable">
        <h1 class="title">Ionic Blank Starter</h1>
      </ion-header-bar>
      <ion-content>
      </ion-content>
    </ion-pane>
  </body>
</html>
solução!

O service work é uma nova feature que possibilita você interceptar suas requisições do lado do cliente.

Pode ver mais detalhes aqui:

https://braziljs.org/blog/service-worker-a-revolucao-da-plataforma-web/

Já o manifest.json é um arquivo de configuração usado principalmente em PWA.

Esse arquivo não era criado na versão anterior e pode ter sido adicionado nas versões mais novas. No nosso curso a gente n'ão vai usar.