Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. js callback asynchron problem

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    js callback asynchron problem

    This topic has been deleted. Only users with topic management privileges can see it.
    • AlCalzone
      AlCalzone Developer @liv-in-sky last edited by

      @liv-in-sky https://gist.github.com/AlCalzone/d14b854b69ce5e8a03718336cc650a95
      😎

      liv-in-sky 1 Reply Last reply Reply Quote 1
      • liv-in-sky
        liv-in-sky @AlCalzone last edited by

        @AlCalzone danke werd ich mal durcharbeiten

        1 Reply Last reply Reply Quote 0
        • F
          fastfoot @liv-in-sky last edited by

          @liv-in-sky sagte in js callback asynchron problem:

          ....wenn man so was wie mit dem type-script kurs für adapterentwickler machen würde....

          gibt es dazu einen Link?

          liv-in-sky 1 Reply Last reply Reply Quote 0
          • liv-in-sky
            liv-in-sky @fastfoot last edited by

            @fastfoot

            https://forum.iobroker.net/topic/36493/09-09-20-30-einsteiger-cursus-demonstration-von-typescript

            F 1 Reply Last reply Reply Quote 1
            • F
              fastfoot @liv-in-sky last edited by

              @liv-in-sky cool, Danke!

              1 Reply Last reply Reply Quote 0
              • OliverIO
                OliverIO @AlCalzone last edited by

                @AlCalzone

                Async und await machen aus asynchronen Funktionen wieder synchrone Funktionen.
                Das will er ja nicht

                OliverIO hanss AlCalzone 3 Replies Last reply Reply Quote 0
                • OliverIO
                  OliverIO @OliverIO last edited by OliverIO

                  Hier mal ein kurzer Artikel, der auf einen Punkt eingeht, der die Funktionsweise der asynchronen Funktionen (callback oder auch promise basiert) erklärt

                  https://dev.to/steelvoltage/if-javascript-is-single-threaded-how-is-it-asynchronous-56gd

                  1 Reply Last reply Reply Quote 0
                  • hanss
                    hanss @OliverIO last edited by

                    @OliverIO
                    Vielen Dank, ich habe das jetzt so gelöst:

                    In die Funktion setRT() einen Raumzähler und das Script eingefügt, wenn alle Räume durchlaufen sind:
                    Das ist sehr übersichtlich und nicht so kompliziert wie async und await.
                    Ich glaube, das kapier ich nicht mehr.

                    setRT() {
                      Raumctr++
                      //mein Script
                    
                       if (S_Raum.length == Raumctr){              // letzter Raum
                           // Script hier, wenn alle Räume durchlaufen sind 
                           Raumctr=0        
                       }
                    }
                    
                    1 Reply Last reply Reply Quote 0
                    • AlCalzone
                      AlCalzone Developer @OliverIO last edited by AlCalzone

                      @OliverIO wieso nicht? Wenn man etwas ausführen will, nachdem asynchrone Vorgänge durch sind, ist async/await genau das richtige Mittel.
                      Und IMO intuitiver als der callback Krempel. Nach dem Aufruf mit await ist es einfach fertig.

                      OliverIO 1 Reply Last reply Reply Quote 0
                      • OliverIO
                        OliverIO @AlCalzone last edited by

                        @AlCalzone
                        Ah hatte einer seiner Antworten falsch interpretiert. Hab nochmal gelesen.
                        Wenn er mit seiner Lösung nun zufrieden ist, ist ja alles gut

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        986
                        Online

                        31.8k
                        Users

                        80.0k
                        Topics

                        1.3m
                        Posts

                        5
                        16
                        773
                        Loading More Posts
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes
                        Reply
                        • Reply as topic
                        Log in to reply
                        Community
                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                        The ioBroker Community 2014-2023
                        logo