From fb80cc5a8d119daffdbf9d63d908cf0c35d8d072 Mon Sep 17 00:00:00 2001 From: Luke Westby Date: Tue, 26 Jul 2016 09:17:03 -0500 Subject: [PATCH] correct js example --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 06d36bb..bf4ed3b 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,18 @@ main = **app.js** ```javascript -var app = Elm.Main.worker() -app.ports.modelOut.subscribe(function (model) { - document.getElementById('seconds').innerHTML = model.toString() +window.addEventListener('loaded', function () { + var app = Elm.Main.worker() + + app.ports.modelOut.subscribe(function (model) { + document.getElementById('count').innerHTML = model; + }) + + document + .getElementById('incrementButton') + .addEventListener('click', function () { + app.ports.messagesIn.send('Increment') + }) }) ```