Skip to content

Commit 4f99dad

Browse files
committed
Don't load Elm apps in app.js
1 parent 04ee17c commit 4f99dad

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

assets/js/app.js

-37
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
import NewFeed from '../elm/app/App/NewFeed.elm';
2-
31
import { Socket } from '../../deps/phoenix';
42
import { LiveSocket } from '../../deps/phoenix_live_view';
53

6-
const hooks = {
7-
ElmModules: {
8-
mounted() {
9-
mountElmModules();
10-
},
11-
},
12-
};
13-
144
const csrfToken = document
155
.querySelector("meta[name='csrf-token']")
166
.getAttribute('content');
177
const liveSocket = new LiveSocket('/live', Socket, {
18-
hooks,
198
longPollFallbackMs: 2500,
209
params: { _csrf_token: csrfToken },
2110
});
@@ -28,32 +17,6 @@ liveSocket.connect();
2817
// >> liveSocket.disableLatencySim()
2918
window.liveSocket = liveSocket;
3019

31-
const Elm = {
32-
App: { NewFeed: NewFeed.Elm.App.NewFeed },
33-
};
34-
35-
const mountElmModules = () => {
36-
const nodes = document.querySelectorAll('[data-elm-module]');
37-
38-
return [...nodes].reduce((acc, node) => {
39-
// The module name may be `App` or `App.Feeds`. `modulePath` would be
40-
// ["App"] or ["App", "Feeds"], then.
41-
const moduleName = node.dataset.elmModule;
42-
const modulePath = moduleName.split('.');
43-
const elmModule = modulePath.reduce((acc, part) => acc[part], Elm);
44-
45-
const params = JSON.parse(node.dataset.elmParams) || {};
46-
47-
if (elmModule != undefined) {
48-
acc[moduleName] = elmModule.init({ node, flags: params });
49-
} else {
50-
console.error(`No module named ‘${moduleName}’ could be found`);
51-
}
52-
53-
return acc;
54-
}, {});
55-
};
56-
5720
window.addEventListener('phx:live_reload:attached', ({ detail: reloader }) => {
5821
reloader.enableServerLogs();
5922
window.liveReloader = reloader;

0 commit comments

Comments
 (0)