title: Properly Fire Functions within Web Workers using Vue.Js
body: <p>im attempting to use <a href="https://github.com/israelss/vue-worker" rel="nofollow noreferrer">vue-worker</a> to offload a task that processes an selected input file to base64, to a background thread.However i'm having no success. Here is what I am attempting:</p>
  
  <pre><code> // file is selected file from input
   const getBase64 = (file) =&gt; {
     return new Promise((resolve, reject) =&gt; {
       const reader = new FileReader()
       reader.readAsDataURL(file)
       reader.onload = () =&gt; resolve(reader.result)
       reader.onerror = error =&gt; reject(error)
     })
   }
  
  this.$worker.run((file, getBase64) =&gt; {
  
    getBase64(file).then((data) =&gt; {
       return data
    })
  
  }, [file, getBase64])
  .then(result =&gt; {
    console.log(result)
  })
  .catch(e =&gt; {
    console.error(e)
  })
  </code></pre>
  
  <p>However I get the following error:</p>
  
  <blockquote>
    <p>DOMException: Failed to execute 'postMessage' on 'Worker': function
    getBase64(file) {   return new Promise(function (resolve, reject) {
        var reader = new FileReader();...... } could not be cloned.</p>
  </blockquote>
  
  <p>What exactly does this error relate to &amp; is what I'm trying accomplish possible?</p>