title: How to create worker with elm 0.17
body: <p>For elm 0.16, I just defined some ports
   (that are just <code>Signal</code> of data) without main function and
  used <code>Signal.map</code> to process data back and forth.
  It is just for data processing called from nodejs (not from browser),
   so I do not depend on <code>Html</code> module.</p>
  
  <p>Now elm 0.17 has <code>Cmd</code> and <code>Sub</code> instead of <code>Signal</code>,
  I cannot figure out how to do the same...</p>
  
  <p>Can anybody give me an simplest example to do data
  processing via ports exposed by <code>worker</code> initialization
   with elm 0.17?</p>
  
  <hr>
  
  <p>Here is my simplest example with Elm 0.16...</p>
  
  <p><strong>elm 0.16 code:</strong>
  </p>
  
  <pre><code>module Main where
  import Signal
  import String exposing (isEmpty, reverse)
  
  -- input ports
  port jsToElm : Signal String
  
  -- output ports
  port elmToJs : Signal String
  port elmToJs
    = Signal.map String.reverse jsToElm
  </code></pre>
  
  <p><strong>javascript (es6) code:</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>/** main */
  const Elm = loadElm('./index.js') // custom function to eval Elm code
  const app = Elm.worker( Elm.Main, { jsToElm: ''})
  
  app.ports.jsToElm.send('test')
  
  app.ports.elmToJs.subscribe(( txt ) =&gt; {    
      console.log( txt )
  })
  </code></pre>