TypeScript Basics 31 - Using callbacks and handling repo response

Поділитися
Вставка
  • Опубліковано 21 гру 2024

КОМЕНТАРІ • 20

  • @asmrtist9058
    @asmrtist9058 4 роки тому +1

    you collower count between then and now has increased from 819 to 2438, you're a rockstar.

  • @bhujathasoorishetty9700
    @bhujathasoorishetty9700 4 роки тому

    Amazing... Keep up the good work!

  • @anurag9110
    @anurag9110 3 роки тому

    In my opinion, using callbacks has made the whole flow complex. I hope there are simpler ways.

  • @keshavabanda9875
    @keshavabanda9875 3 роки тому

    thank you for all tuts

  • @harishjayachandran5596
    @harishjayachandran5596 3 роки тому

    why we need to use callback functions. ? why not just return the objects ?

  • @hyperborean72
    @hyperborean72 4 роки тому +1

    I did not understand the main idea - why the asynchronous method may not return anything. Sooner or later asynchronous method will end with some result then why returning it is impossible?
    At least in Java we may create the method with few blocking calls which returns smth
    Anyway 'cb: (user: User) => any' means that we operate with the method result

    • @amolsw
      @amolsw 4 роки тому

      I have exactly same question. Why is the issue in the method returning the response

  • @canmertinyo
    @canmertinyo Рік тому

    Thankss

  • @simzpahuja
    @simzpahuja 5 років тому

    If I wrap the Repo object creation in curly braces as below: I stop getting the repo arrays. It returns, list of undefined arrays, Any reason why {} in *{* new Repo(repo) *}* would make it break?
    getRepos(userName: string, cb : (repos: Repo[])=> any){
    request.get("api.github.com/users/"+userName+"/repos", OPTIONS, (error: any, response: any, body:any)=>{
    let repoArray = body;
    let repos = repoArray.map((repo: any)=> *{* new Repo(repo) *}* );
    cb(repos);
    })
    }
    If curly braces are removed, it works fine. Any one ?

  • @marcholman291
    @marcholman291 3 роки тому

    Don't sweat the mistake - he explains it towards the end :)

  • @Fallst4d
    @Fallst4d 6 років тому +1

    Why do you use so many `let`s?

    • @SogMosee
      @SogMosee 6 років тому +3

      @Stink Whistle never use let. Always use const. Immutability is essential.

  • @MikeMitterer
    @MikeMitterer 5 років тому +1

    Avoid callbacks return any. Use a type for this or use void

  • @hyperborean72
    @hyperborean72 4 роки тому +2

    It still looks like a bit of dark magic

  • @ahmedatalla2275
    @ahmedatalla2275 6 років тому +1

    Thanks for the great tutorial
    but we need to handle the error in the callback as well, like this
    gist.github.com/a-atalla/fa2e77e1f9223e610f4fe5edb5a3fb9d

  • @ravikapa1
    @ravikapa1 6 років тому

    Repo method is not getting called. pz help wasted a day on fxiing this

  • @musicallifetherp4955
    @musicallifetherp4955 4 роки тому

    the sound comes very slow in your every video. Do something