Last active
December 5, 2018 23:04
-
-
Save AyoAlfonso/44921d94958cc8f254855d074238c6a1 to your computer and use it in GitHub Desktop.
Entry point of our Firebase react app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @description Entry point of our app | |
*/ | |
const Component = () => ( | |
<Provider store={store}> | |
<App /> | |
</Provider> | |
) | |
const render = () => { | |
ReactDOM.render(<Component />, document.getElementById('root'), () => { | |
window.store = store | |
}) | |
} | |
render() | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('./assets/firebase-messaging-sw.js',) | |
.then(function (registration) { | |
firebase.messaging().useServiceWorker(registration); | |
initializePush(messaging) | |
console.log("This service worker is registered") | |
}).catch(function (err) { | |
console.log('Service worker registration failed, error:', err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment