Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.uploader.on(...) is not a function #272

Open
matheusvps opened this issue Aug 18, 2023 · 3 comments
Open

this.uploader.on(...) is not a function #272

matheusvps opened this issue Aug 18, 2023 · 3 comments

Comments

@matheusvps
Copy link

Hello, currently using V4 on my project.
Did this :

    this.uploader.startUpload(payload);
    console.debug(this.uploader.acknowledgeEvent);
    this.uploader.on('event', (event) => {
      console.debug(event, 'evento do on');
    });
    this.uploader.acknowledgeEvent('blablablaa', (event) => {
      console.debug('sucess', event);
    }, (error) => {
      console.debug('error', error);
    });

Obs : the object uploader is initialized when my app is mounted. The acknowledgeEvent returns "sucess OK" but the "this.uploader.on(...)" returns on is not a function.
I need to hear the events clearly because the startUpload is called when I click a button but my documents isn't sended and I got none on my network... Do I need to downgrade my plugin version ? How can I fix that ?

@zfir
Copy link
Member

zfir commented Aug 21, 2023

Hello @matheusvps,

For V4, we don't listen on event.

Here is an example how we listen to the callback.

FileTransferManager.init(
        { parallelUploadsLimit: 2 },
        (upload) => {...});

The callback is in the initialiser.

@matheusvps
Copy link
Author

Hello @zfir !
Got it, did something like this :

this.uploader = FileTransferManager.init({ parallelUploadsLimit: 1 }, async event => {
        console.debug('initialized');
        if (event.eventId) {
          console.debug('new event was fired', event);
            if (event.state === 'UPLOADED') {
              Vue.prototype.$event.$emit('upload-success', {
                docId: event.eventId,
              });
            } else if (event.state === 'FAILED') {
              Vue.prototype.$event.$emit('upload-error', {
                docId: event.eventId,
              });
            } else if (event.state === 'UPLOADING') {
              Vue.prototype.$event.$emit('upload-progress', {
                docId: docId,
                progress: Math.round(event.progress),
              });
            }

But when I call the .startUpload function, no events are fired, no network updates... and the uploader object is already initialized.

@zfir
Copy link
Member

zfir commented Aug 22, 2023

Hello @matheusvps,

This can be due to the payload that you are sending. Can you send a payload example.

Also to see if you are having a problem with plugin, you can use Android Studio to debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants