Skip to content

DOMException: Failed to execute 'postMessage' on 'Worker': function (a, b, c) { #3

Description

@fortil

Hi
So thanks by the repo, it's great!!
I can't run the code, it throw me:

DOMException: Failed to execute 'postMessage' on 'Worker': function (a, b, c) {
        if (this instanceof C) {
          switch (arguments.length) {
            case 0:...<omitted>... } could not be cloned.

And my code it's this:

    worker.run(() => {
      if ('indexedDB' in self) {
        return new Promise((resolve, reject) => {
          var openRequest = indexedDB.open('database', 1)
          var db

          openRequest.onsuccess = (event) => {
            db = openRequest.result
            console.log(db)
            getData(db)
          }
          function getData(db) {
            var transaction = db.transaction(['database'], 'readwrite')
            var objectStore = transaction.objectStore('database')

            var objectStoreRequest = objectStore.get('entries')

            objectStoreRequest.onsuccess = function(event) {
              console.log((objectStoreRequest.result))
              resolve(objectStoreRequest.result)
            }
            objectStore.onerror = function(event) {
              reject(transaction.error)
            }
          }
        })
      }
    })
      .then(console.log)
      .catch(console.log)

Any idea?
Thanks

Edit: I have to send 'Promise', cause webpack transform 'Promise'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions