Discussion:
[elm-discuss] `Uncaught ReferenceError: Elm is not defined` in Electron app
A. Hernandez
2016-09-04 21:44:52 UTC
Permalink
Hi all,

I am attempting to use Elm 0.17 for an Electron app (using
`electron-prebuilt` 1.3.5). However, I've run into a snag where an `Elm is
not defined` error raises on launch. For some reason, `Elm` isn't a global
variable in Electron. It is global when run in the browser though.

Does this have to do with the Chromium version? More importantly: is there
a way to fix this issue?
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Leroy Campbell
2016-09-05 00:07:14 UTC
Permalink
You can require the script (as a CommonJS module).
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
A. Hernandez
2016-09-05 01:38:50 UTC
Permalink
Worked like a charm. Thanks!

- Alex

On September 5, 2016 at 10:07:18 AM, Leroy Campbell (***@gmail.com)
wrote:

You can require the script (as a CommonJS module).
--
You received this message because you are subscribed to a topic in the
Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elm-discuss/uosHiES0CK4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Rupert Smith' via Elm Discuss
2016-10-27 16:13:01 UTC
Permalink
Post by A. Hernandez
Worked like a charm. Thanks!
Good to hear. My next project will be an Elm + Electron one, I was until
now wondering how well that might work out.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
c***@gmail.com
2017-11-29 19:43:47 UTC
Permalink
Any thoughts on why that has happened?
Post by Leroy Campbell
You can require the script (as a CommonJS module).
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
AIon
2016-10-27 14:30:16 UTC
Permalink
You can atach Elm to the window object like this:

<script>window.Elm = require('./main.js');</script>

then you do:

var node = document.getElementById('main');
var yourApp = Elm.Todo.fullscreen(node);

You can see this here:
https://github.com/nirgn975/Elmctron/blob/master/src/index.html#L11
Post by A. Hernandez
Hi all,
I am attempting to use Elm 0.17 for an Electron app (using
`electron-prebuilt` 1.3.5). However, I've run into a snag where an `Elm is
not defined` error raises on launch. For some reason, `Elm` isn't a global
variable in Electron. It is global when run in the browser though.
Does this have to do with the Chromium version? More importantly: is there
a way to fix this issue?
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...