Import user-index in example.

This commit is contained in:
Dillon Kearns 2020-10-16 10:36:12 -07:00
parent 094f108890
commit 4137773928
3 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,7 @@
// @ts-ignore
// const { Elm } = require("./src/Main.elm");
import { Elm } from "/main.js";
import userInit from "/user-index.js";
// const pagesInit = require("../../index.js");
let prefetchedPages;
@ -159,9 +160,11 @@ function httpGet(/** @type string */ theUrl) {
});
}
pagesInit({
mainElmModule: Elm.Main,
});
userInit(
pagesInit({
mainElmModule: Elm.Main,
})
);
// function pagesInit(config) {
// const path = window.location.pathname.replace(/(\w)$/, "$1/");

View File

@ -0,0 +1,9 @@
export default function (elmLoaded) {
console.log("Hello outside of promise!");
elmLoaded.then((elmPagesApp) => {
console.log("Inside of promise");
elmPagesApp.ports.example.subscribe((message) => {
console.log("Elm port message: ", message);
});
});
}

View File

@ -129,6 +129,7 @@ async function runTerser(filePath) {
async function copyAssets() {
fs.copyFile("index.js", "dist/index.js");
fs.copyFile("user-index.js", "dist/user-index.js");
fs.copyFile("style.css", "dist/style.css");
}