diff options
author | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
commit | 4fe1689de43f4404eb9530fcfbcbfb26d6c1c13a (patch) | |
tree | 6811b845bb7f4966b10dcefa3dea404246f161c7 /app/javascript/mastodon/main.js | |
parent | 65c1e53a32cabcdbb7bca57002bb0f6acdebe07e (diff) | |
parent | bed63f6dae0879ac840066b031229e0d139089cd (diff) |
Diffstat (limited to 'app/javascript/mastodon/main.js')
-rw-r--r-- | app/javascript/mastodon/main.js | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/app/javascript/mastodon/main.js b/app/javascript/mastodon/main.js deleted file mode 100644 index 69a7ee91f..000000000 --- a/app/javascript/mastodon/main.js +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import { setupBrowserNotifications } from 'mastodon/actions/notifications'; -import Mastodon, { store } from 'mastodon/containers/mastodon'; -import { me } from 'mastodon/initial_state'; -import ready from 'mastodon/ready'; - -const perf = require('mastodon/performance'); - -/** - * @returns {Promise<void>} - */ -function main() { - perf.start('main()'); - - return ready(async () => { - const mountNode = document.getElementById('mastodon'); - const props = JSON.parse(mountNode.getAttribute('data-props')); - - ReactDOM.render(<Mastodon {...props} />, mountNode); - store.dispatch(setupBrowserNotifications()); - - if (process.env.NODE_ENV === 'production' && me && 'serviceWorker' in navigator) { - const { Workbox } = await import('workbox-window'); - const wb = new Workbox('/sw.js'); - /** @type {ServiceWorkerRegistration} */ - let registration; - - try { - registration = await wb.register(); - } catch (err) { - console.error(err); - } - - if (registration) { - const registerPushNotifications = await import('mastodon/actions/push_notifications'); - - store.dispatch(registerPushNotifications.register()); - } - } - - perf.stop('main()'); - }); -} - -export default main; |