12

Holy fuck js. And jQuery.
Your delay thingy is terrible!

Comments
  • 2
    Are you perhaps looking for the holy grail called "Promises"?
  • 3
    delay?
    setTimeout(e => { stuff here; }, timeout);
  • 1
    @olback yea and that's fucking bullshit xD

    Well it isn't really like most js rants but it's so different from other languages..
  • 1
    @Meta what do you mean, explain pls xD
  • 2
    @BambuSource Promises are great if you really know how to handle them.
  • 2
    You don't need delay, when you have promises.
    Try them
  • 0
    @sanjay15693 @olback @Meta

    I looked it up and my mind is like "wtf"..

    Where to start? ;-;
  • 1
    @BambuSource No idea, I don't know how they work either.
  • 1
    @BambuSource you can just Google. There are lot of examples.

    Basically instead of waiting in uncertainty, use promises.

    Let's say, u want to download a image.
    Create a promise for the request.
    There are lifecycle methods like then,done,fail which you use to define what you do when operation is successful or failure.

    Just try some basic examples.
    Here's explanation from Google.
    https://developers.google.com/web/...
  • 2
    Thingy 😊
  • 1
    @BambuSource basically promises are state machines where the states represent the "readiness" of a result. There's probably some code you can find online that does what you're looking for with promises. It's a little unwieldy if you're trying to use the result in a synchronous manner unless you're using async and await.
  • 1
    I read that as fuck.js at first glance.
Add Comment