on master help sign in
Bug fixes from the Init.js refactor that just happened.
cb154acevancz
runtime/Init.js+3−3
@@ -89,21 +89,21 @@ function initGraphics(elm, Module) {
89 var signalGraph = Module.main;
89 var signalGraph = Module.main;
90
90
91 // make sure the signal graph is actually a signal & extract the visual model
91 // make sure the signal graph is actually a signal & extract the visual model
92+ var Signal = Elm.Signal(elm);
92 if (!('recv' in signalGraph)) {
93 if (!('recv' in signalGraph)) {
93− var Signal = Elm.Signal(elm);
94 signalGraph = Signal.constant(signalGraph);
94 signalGraph = Signal.constant(signalGraph);
95 }
95 }
96 var currentScene = signalGraph.value;
96 var currentScene = signalGraph.value;
97
97
98 // Add the currentScene to the DOM
98 // Add the currentScene to the DOM
99 var Render = ElmRuntime.use(ElmRuntime.Render.Element);
99 var Render = ElmRuntime.use(ElmRuntime.Render.Element);
100− container.appendChild(Render.render(currentScene));
100+ elm.node.appendChild(Render.render(currentScene));
101 if (elm.Native.Window) elm.Native.Window.resizeIfNeeded();
101 if (elm.Native.Window) elm.Native.Window.resizeIfNeeded();
102
102
103 // set up updates so that the DOM is adjusted as necessary.
103 // set up updates so that the DOM is adjusted as necessary.
104 function domUpdate(newScene) {
104 function domUpdate(newScene) {
105 ElmRuntime.draw(function(_) {
105 ElmRuntime.draw(function(_) {
106− Render.update(container.firstChild, currentScene, newScene);
106+ Render.update(elm.node.firstChild, currentScene, newScene);
107 currentScene = newScene;
107 currentScene = newScene;
108 if (elm.Native.Window) elm.Native.Window.resizeIfNeeded();
108 if (elm.Native.Window) elm.Native.Window.resizeIfNeeded();
109 });
109 });