mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-03 01:16:14 +03:00
Import user-index in example.
This commit is contained in:
parent
094f108890
commit
4137773928
@ -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/");
|
||||
|
9
examples/simple/user-index.js
Normal file
9
examples/simple/user-index.js
Normal 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);
|
||||
});
|
||||
});
|
||||
}
|
@ -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");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user