Skip to content

Commit

Permalink
Initialize programs the new way
Browse files Browse the repository at this point in the history
  • Loading branch information
evancz committed Aug 10, 2016
1 parent 46ec85c commit 0fee899
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Pipeline/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,17 @@ footer rootModules =
export :: Module.Canonical -> String
export canonicalName@(Module.Canonical _ moduleName) =
let
jsName =
makeProgram =
Module.qualifiedVar canonicalName "main"

object =
objectFor moduleName

name =
Module.nameToString moduleName
in
setup moduleName
++ "_elm_lang$core$Native_Platform.addPublicModule(" ++ objectFor moduleName
++ ", '" ++ Module.nameToString moduleName
++ "', typeof " ++ jsName ++ " === 'undefined' ? null : " ++ jsName ++ ");"
++ makeProgram ++ "(" ++ object ++ ", '" ++ name ++ "');"


setup :: [String] -> String
Expand Down

0 comments on commit 0fee899

Please sign in to comment.