Coder Social home page Coder Social logo

Comments (9)

uqee avatar uqee commented on June 13, 2024

Hi! Could you please clarify a little more? I don't really understand what do you want to achieve.

from angular-evaporate.

ryaz avatar ryaz commented on June 13, 2024

Thanks for quick reply! I figured it out in my own way, but I think it should be something simplier and more straightforward:

      $scope.ae.$add({
        file: file,
        started: function () {
          console.log('started');
        },
        complete: function () {
          var now = Date.now();
          console.log('complete................yay!');
          this.$stopped = now;
          uploadSuccessCallback(this.$url);
          this.$dequeue();
        },
        error: function (msg) {
          var now = Date.now();
          this.$errorMsg = msg;
          this.$stopped = now;
          console.log('Upload #%f failed, msg = %s', this.$id, msg);
          uploadFailedCallback(msg);
        }
      });

because I have to manually set $stopped and $dequeue

from angular-evaporate.

uqee avatar uqee commented on June 13, 2024
  1. The necessity of automatic $dequeue() when completed is debatable for me. Probably somebody would want the opposite if we changed this behaviour.
  2. But I'm worried about the $stopped and $errorMsg values. Are you sure they were really undefined before you manually set them? If so, it's definitely a bug, but a strange one, because they're being set right before the custom callback is going to be launched. Could you provide a complete fiddle may be?

from angular-evaporate.

ryaz avatar ryaz commented on June 13, 2024
  1. So I think it will be cool to have it in settings. In your approach you have all uploads in one place, thats why it doesnt make any sense for you do dequeue upload after its finished. But imagine situation when you have tiles on UI showing progresses on each tile. And you want to hide progress bar and do some UI stuff when upload is finished. In that situation it would be cool and makes sense to dequeue upload.
  2. I'll double check and do fiddle later today or on monday if it doesn't work.

from angular-evaporate.

uqee avatar uqee commented on June 13, 2024
  1. Ok, now I got it. You're talking about some new flag, like $rinserepeat, for a directive, right? Probably a good idea, worth to be considered at least. I'll tag this thread accordingly and implement it as soon as I have time (unfortunately, not very soon). If you need this right now, then a PR is a good idea, but I guess you don't)
  2. Good.

from angular-evaporate.

ryaz avatar ryaz commented on June 13, 2024
  1. Yeah, I meant it. It would be cool to run some callback on $dequeue.
  2. You were right $stopped is set on complete and on error, my bad.

I found another issue. I got error 'Error completing upload'. And right after error, complete callback was called. Is that by design? Maybe it make sense to have completed and finished? Because right now I have completed upload but with error 'Error completing upload'...

from angular-evaporate.

uqee avatar uqee commented on June 13, 2024

Well, the callbacks are fired by Evaporate itself, whereas AngularEvaporate just wraps them to implicitly save timestamps, messages and some other similar stuff. So in case of their odd behaviour or to request a new one, it's conceptually better to report an issue there, then implement a custom dependant fix here.

from angular-evaporate.

uqee avatar uqee commented on June 13, 2024

Btw, why do you need a callback on dequeue? It's a synchronous operation, so basically you can do whatever you need right after dequeuing. And when it dequeues automatically on complete, you still have a complete callback.

from angular-evaporate.

ryaz avatar ryaz commented on June 13, 2024

Yeah, I do something like that. Wrapping dequeue in controller function. So maybe this way is better, thanks. Was just curious about to have upload.$dequeue calling some stuff under the hood.

from angular-evaporate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.