flowjs / flow.js

A JavaScript library providing multiple simultaneous, stable, fault-tolerant and resumable/restartable file uploads via the HTML5 File API.
Other
2.96k stars 346 forks source link

Errors when initializing flow object for vue project #293

Closed RmaxTwice closed 4 years ago

RmaxTwice commented 4 years ago

Hello there seems to be an issue when using this library in a vue project creatd with vue CLI, I have tried to import and configure the flow object using the following code:

import Flow from '@flowjs/flow.js'

var flow = Flow ({
target: 'my url target...',
})

However this fails with the following error:

vue.runtime.esm.js?2b0e:1888 TypeError: Cannot set property 'support' of undefined
    at Flow (flow.js?ebc7:46)
    at VueComponent.created (MyComponent.vue?e04b:192)
    at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
    at callHook (vue.runtime.esm.js?2b0e:4219)
    at VueComponent.Vue._init (vue.runtime.esm.js?2b0e:5008)

It fails when I use it in the main.js to set the flow object as a vue prototype and if I use it directly inside a vue component as well...

Can anyone help?

command-tab commented 4 years ago

I just created a new project with vue create flowtest, added and installed @flowjs/flow.js, and quickly initialized Flow inside App.vue without issue 🤔Here's a working example that brings up the open/save dialog and accepts drag-and-drop: https://github.com/command-tab/flowtest

RmaxTwice commented 4 years ago

You are correct it does initialize the object correctly, my mistake was missing the New operator. Thank you.