on master help sign in
Make sure Display ADT does not need to leak out of this module

Makes it possible to stop using ElmRuntime entirely

commitf8571eb166595079b9d658d7854f5cd647d26713 authorEvan Czaplicki <info@elm-lang.org> dateTue 4 Nov 2014, 16:48 (12 years ago) parent4202ce2
1 file changed+18−9
runtime/core.js+18−9
runtime/core.js+18−9
@@ -95,14 +95,17 @@ function init(display, container, module, ports, moduleToReplace) {
9595 // create the actual RTS. Any impure modules will attach themselves to this
9696 // object. This permits many Elm programs to be embedded per document.
9797 var elm = {
98− notify:notify,
99− setTimeout:setTimeout,
100− node:container,
101− display:display,
102− addListener:addListener,
103− inputs:inputs,
104− timer:timer,
105− ports: { incoming:ports, outgoing:{}, uses:portUses }
98+ notify: notify,
99+ setTimeout: setTimeout,
100+ node: container,
101+ addListener: addListener,
102+ inputs: inputs,
103+ timer: timer,
104+ ports: { incoming:ports, outgoing:{}, uses:portUses },
105+
106+ isFullscreen: function() { return display === Display.FULLSCREEN; },
107+ isEmbed: function() { return display === Display.COMPONENT; },
108+ isWorker: function() { return display === Display.NONE; }
106109 };
107110
108111 function swap(newModule) {
@@ -169,7 +172,13 @@ function checkPorts(elm) {
169172 }
170173 }
171174}
172−
175+
176+
177+//// FILTER SIGNALS ////
178+
179+// TODO: move this code into the signal module and create a function
180+// Signal.initializeGraph that actually instantiates everything.
181+
173182function filterListeners(inputs, listeners) {
174183 loop:
175184 for (var i = listeners.length; i--; ) {