!gWixeTZFHPNHXCtrwz:matrix.org

Node.js

252 Members
Node.js is a JavaScript runtime | https://nodejs.org/ | ✨ 🐢 🚀 ✨ | Mission statement: http://bit.ly/28Ix9uj16 Servers

Load older messages


SenderMessageTime
30 Jan 2020
@s_leonardo:tomesh.net@s_leonardo:tomesh.neti'm trying somthing like this but he cant find the function callbacl13:46:07
@s_leonardo:tomesh.net@s_leonardo:tomesh.net * i'm trying somthing like this but he cant find the function callback13:46:14
@joelwallis1:matrix.org@joelwallis1:matrix.org Can you show me the code you're using? 13:48:45
@joelwallis1:matrix.org@joelwallis1:matrix.orgBtw, Node.js callbacks has an error parameter in its signature13:49:08
@s_leonardo:tomesh.net@s_leonardo:tomesh.net *
var serialNumber = require('serial-number');
class genConfigIOT {

    callback(value) {
      this.serial = value;
    }
  
    getSerial() {
      serialNumber(function (err, value) {
        console.log(value);
        callback(value);
      })
    }
}
13:49:16
@joelwallis1:matrix.org@joelwallis1:matrix.org So, always use callback(err, value) {} 13:49:35
@joelwallis1:matrix.org@joelwallis1:matrix.orgIs that all of your code?13:49:59
@s_leonardo:tomesh.net@s_leonardo:tomesh.netyeah13:50:11
@joelwallis1:matrix.org@joelwallis1:matrix.org You're creating a class. Just that. 13:51:06
@s_leonardo:tomesh.net@s_leonardo:tomesh.netand serial number is this package https://www.npmjs.com/package/serial-number13:51:10
@joelwallis1:matrix.org@joelwallis1:matrix.org It seems that you're trying to do build something, but you're quite lost ok how to even start. What are you trying to do? 13:51:52
@s_leonardo:tomesh.net@s_leonardo:tomesh.netits just a test13:52:21
@joelwallis1:matrix.org@joelwallis1:matrix.org "on how to even start" 13:52:16
@s_leonardo:tomesh.net@s_leonardo:tomesh.netget serial number of linux13:52:38
@s_leonardo:tomesh.net@s_leonardo:tomesh.netit will be a bigger class but this is just the start13:55:55
@joelwallis1:matrix.org@joelwallis1:matrix.orgI see13:56:28
@s_leonardo:tomesh.net@s_leonardo:tomesh.net
var config = new genConfigIOT()
config.getSerial();
13:56:38
@s_leonardo:tomesh.net@s_leonardo:tomesh.neti'm testing like this13:56:56
@s_leonardo:tomesh.net@s_leonardo:tomesh.net
async getSerial() {
    this.serial = await new Promise(resolve => {
      serialNumber(function (err, value) {
        if(err){
          console.log(err);
        }     
        resolve(value)
      })
    })        
  }
14:20:16
@s_leonardo:tomesh.net@s_leonardo:tomesh.neti got it14:20:19
@s_leonardo:tomesh.net@s_leonardo:tomesh.net i dont need help anymore joelwallis1 14:20:37
@joelwallis1:matrix.org@joelwallis1:matrix.orgAwesome!14:21:15
31 Jan 2020
@layter:matrix.org@layter:matrix.org set a profile picture.04:58:41
3 Feb 2020
@underoot:matrix.org@underoot:matrix.org joined the room.08:53:06
4 Feb 2020
@himself65:matrix.orghimself65 joined the room.18:18:42
5 Feb 2020
@azaeres:matrix.orgazaeres joined the room.00:11:37
@azaeres:matrix.orgazaeres set a profile picture.01:58:30
6 Feb 2020
@mangiacaprini:matrix.org@mangiacaprini:matrix.org joined the room.06:28:46
@leandro:tomesh.netleandro joined the room.21:41:02
7 Feb 2020
@legendecas:matrix.org@legendecas:matrix.org joined the room.03:34:23

Show newer messages


Back to Room ListRoom Version: