1+ // Initialize Firebase
2+ var config = {
3+ apiKey : "AIzaSyBX6l4geba-CjXE_WlQwOX6pxCIrVl-tjk" ,
4+ authDomain : "wise-bongo-209220.firebaseapp.com" ,
5+ databaseURL : "https://wise-bongo-209220.firebaseio.com" ,
6+ projectId : "wise-bongo-209220" ,
7+ storageBucket : "wise-bongo-209220.appspot.com" ,
8+ messagingSenderId : "926874022337"
9+ } ;
10+ firebase . initializeApp ( config ) ;
11+ export const inicializarFirebase = ( ) => {
12+ firebase . initializeApp ( {
13+ messagingSenderId : '926874022337'
14+ } ) ;
15+ navigator . serviceWorker
16+ . register ( '/my-sw.js' )
17+ . then ( ( registration ) => {
18+ firebase . messaging ( ) . useServiceWorker ( registration ) ;
19+ } ) ;
20+ }
21+
22+ var cacheName = 'v1' ;
23+ // A list of local resources we always want to be cached.
24+ var cacheFiles = [
25+ '/' ,
26+ //php
27+ // 'app/public/index.php',
28+ //blade
29+ //'app/resources/views/pages/home.blade.php',
30+ //css
31+ //'app/public/css/index.min.css',
32+ //jquery
33+ //'app/public/css/jquery/jquery-ui.min.js',
34+ //'app/public/css/jquery/jquery-ui.js',
35+ //javascript files
36+ //'app/public/js/jquery-3.1.1.js',
37+ //'app/public/js/utils.js',
38+ //'home.js',
39+ //'app/public/js/hover_text.js',
40+ //'app/public/js/service_worker_script.js',
41+ //assets
42+ //'app/public/images/logo.svg',
43+ ]
44+ self . addEventListener ( 'install' , function ( e ) {
45+ console . log ( "[ServiceWorker] Installed" ) ;
46+ try {
47+ e . waitUntil (
48+ caches . open ( cacheName ) . then ( function ( cache ) {
49+ console . log ( "[ServiceWorker] Caching cacheFiles" ) ;
50+ return cache . addAll ( cacheFiles ) ;
51+ } )
52+ )
53+ } catch ( e ) {
54+ console . log ( e ) ;
55+ }
56+ } )
57+
58+ self . addEventListener ( 'activate' , function ( e ) {
59+ console . log ( "[ServiceWorker] Activated" ) ;
60+ } )
61+
62+ self . addEventListener ( 'fetch' , function ( e ) {
63+ //console.log("[ServiceWorker] Fetching", e.request.url);
64+ } )
0 commit comments