@@ -2,7 +2,7 @@
22(function() {
33'use strict';
44
5−Elm.fullscreen = function(module) {
5+Elm.fullscreen = function(module, ports) {
66 var style = document.createElement('style');
77 style.type = 'text/css';
88 style.innerHTML = "html,head,body { padding:0; margin:0; }" +
@@ -10,24 +10,24 @@ Elm.fullscreen = function(module) {
1010 document.head.appendChild(style);
1111 var container = document.createElement('div');
1212 document.body.appendChild(container);
13− return init(ElmRuntime.Display.FULLSCREEN, container, module);
13+ return init(ElmRuntime.Display.FULLSCREEN, container, module, ports);
1414};
1515
16−Elm.embed = function(module, container) {
16+Elm.embed = function(module, container, ports) {
1717 var tag = container.tagName;
1818 if (tag !== 'DIV') {
1919 throw new Error('Elm.node must be given a DIV, not a ' + tag + '.');
2020 } else if (container.hasChildNodes()) {
2121 throw new Error('Elm.node must be given an empty DIV. No children allowed!');
2222 }
23− return init(ElmRuntime.Display.COMPONENT, container, module);
23+ return init(ElmRuntime.Display.COMPONENT, container, module, ports);
2424};
2525
26−Elm.worker = function(module) {
27− return init(ElmRuntime.Display.NONE, {}, module);
26+Elm.worker = function(module, ports) {
27+ return init(ElmRuntime.Display.NONE, {}, module, ports);
2828};
2929
30−function init(display, container, module, moduleToReplace) {
30+function init(display, container, module, moduleToReplace, ports) {
3131 // defining state needed for an instance of the Elm RTS
3232 var inputs = [];
3333
@@ -67,7 +67,8 @@ function init(display, container, module, moduleToReplace) {
6767 display:display,
6868 id:ElmRuntime.guid(),
6969 addListener:addListener,
70− inputs:inputs
70+ inputs:inputs,
71+ ports_in:ports
7172 };
7273
7374 // Set up methods to communicate with Elm program from JS.
@@ -123,7 +124,7 @@ function init(display, container, module, moduleToReplace) {
123124 }
124125
125126 reportAnyErrors();
126− return { send:send, recv:recv, swap:swap };
127+ return { send:send, recv:recv, swap:swap, ports:elm.ports_out };
127128};
128129
129130function filterListeners(inputs, listeners) {