@@ -2,7 +2,7 @@
2(function() {
2(function() {
3'use strict';
3'use strict';
5−Elm.fullscreen = function(module) {
5+Elm.fullscreen = function(module, ports) {
6 var style = document.createElement('style');
6 var style = document.createElement('style');
7 style.type = 'text/css';
7 style.type = 'text/css';
8 style.innerHTML = "html,head,body { padding:0; margin:0; }" +
8 style.innerHTML = "html,head,body { padding:0; margin:0; }" +
@@ -10,24 +10,24 @@ Elm.fullscreen = function(module) {
10 document.head.appendChild(style);
10 document.head.appendChild(style);
11 var container = document.createElement('div');
11 var container = document.createElement('div');
12 document.body.appendChild(container);
12 document.body.appendChild(container);
13− return init(ElmRuntime.Display.FULLSCREEN, container, module);
13+ return init(ElmRuntime.Display.FULLSCREEN, container, module, ports);
16−Elm.embed = function(module, container) {
16+Elm.embed = function(module, container, ports) {
17 var tag = container.tagName;
17 var tag = container.tagName;
18 if (tag !== 'DIV') {
18 if (tag !== 'DIV') {
19 throw new Error('Elm.node must be given a DIV, not a ' + tag + '.');
19 throw new Error('Elm.node must be given a DIV, not a ' + tag + '.');
20 } else if (container.hasChildNodes()) {
20 } else if (container.hasChildNodes()) {
21 throw new Error('Elm.node must be given an empty DIV. No children allowed!');
21 throw new Error('Elm.node must be given an empty DIV. No children allowed!');
23− return init(ElmRuntime.Display.COMPONENT, container, module);
23+ return init(ElmRuntime.Display.COMPONENT, container, module, ports);
26−Elm.worker = function(module) {
26+Elm.worker = function(module, ports) {
27− return init(ElmRuntime.Display.NONE, {}, module);
27+ return init(ElmRuntime.Display.NONE, {}, module, ports);
30−function init(display, container, module, moduleToReplace) {
30+function init(display, container, module, moduleToReplace, ports) {
31 // defining state needed for an instance of the Elm RTS
31 // defining state needed for an instance of the Elm RTS
32 var inputs = [];
32 var inputs = [];
@@ -67,7 +67,8 @@ function init(display, container, module, moduleToReplace) {
67 display:display,
67 display:display,
68 id:ElmRuntime.guid(),
68 id:ElmRuntime.guid(),
69 addListener:addListener,
69 addListener:addListener,
70− inputs:inputs
70+ inputs:inputs,
73 // Set up methods to communicate with Elm program from JS.
74 // Set up methods to communicate with Elm program from JS.
@@ -123,7 +124,7 @@ function init(display, container, module, moduleToReplace) {
125 reportAnyErrors();
126 reportAnyErrors();
126− return { send:send, recv:recv, swap:swap };
127+ return { send:send, recv:recv, swap:swap, ports:elm.ports_out };
129function filterListeners(inputs, listeners) {
130function filterListeners(inputs, listeners) {