Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Hi

Habe mir gerade mal etwas die Node.js bindings angeschaut. Meine Frage hierzu:

Sind die Callbacks die ihr verwendet wirklich asynchron, d.h. benutzt ihr process.nextTick() um einen Callback zu rufen?

 

Beispiel:

ipcon.connect(HOST, PORT,
    function(error) {
        console.log('Error: '+error);
    }
); // Connect to brickd

 

Wird hier die error callback Funktion wirklich asynchron aufgerufen, oder im gleichen EventLoop Durchlauf wie die connect Methode selbst?

 

Nach kurzem Blick in die IPConnection "Klasse" von euch habe ich kein process.nextTick(...) gefunden. Von daher gehe ich aus daß alle Callbacks die ihr aufruft nicht wirklich asynchron sind.

 

Ist das korrekt?

Geschrieben

Die Callbacks sind asynchron, wir verwenden dafür aber nicht process.nextTick(), denn wir verwendet die Callbacks der Socket Klasse.

 

IPConnection.connect() erzeugt einen Socket, registriert zwei Funktionen für das Error und Connect Event und ruft dann Socket.connect() auf. Danach ist IPConnection.connect() durch und returned. Später ruft dann die Socket Klasse entweder die registrierte Error oder Connect Funktion auf vorauf hin die IPConnection entweder deine Error Funktion oder den Connected Callback aufruft.

 

Alle Callbacks der Node.JS Bindings sind in dieser Weise an I/O Operationen gebunden. Alle I/O Operationen in Node.JS sind asynchron und die IPConnection nutzt das einfach. Wir brauchen kein process.nextTick() um asynchron Callbacks zu haben.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.