30 Jan 2020 |
@s_leonardo:tomesh.net | i'm trying somthing like this but he cant find the function callbacl | 13:46:07 |
@s_leonardo:tomesh.net | * i'm trying somthing like this but he cant find the function callback | 13:46:14 |
@joelwallis1:matrix.org | Can you show me the code you're using? | 13:48:45 |
@joelwallis1:matrix.org | Btw, Node.js callbacks has an error parameter in its signature | 13:49:08 |
@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 | So, always use callback(err, value) {} | 13:49:35 |
@joelwallis1:matrix.org | Is that all of your code? | 13:49:59 |
@s_leonardo:tomesh.net | yeah | 13:50:11 |
@joelwallis1:matrix.org | You're creating a class. Just that. | 13:51:06 |
@s_leonardo:tomesh.net | and serial number is this package https://www.npmjs.com/package/serial-number | 13:51:10 |
@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 | its just a test | 13:52:21 |
@joelwallis1:matrix.org | "on how to even start" | 13:52:16 |
@s_leonardo:tomesh.net | get serial number of linux | 13:52:38 |
@s_leonardo:tomesh.net | it will be a bigger class but this is just the start | 13:55:55 |
@joelwallis1:matrix.org | I see | 13:56:28 |
@s_leonardo:tomesh.net | var config = new genConfigIOT()
config.getSerial();
| 13:56:38 |
@s_leonardo:tomesh.net | i'm testing like this | 13:56:56 |
@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 | i got it | 14:20:19 |
@s_leonardo:tomesh.net | i dont need help anymore joelwallis1 | 14:20:37 |
@joelwallis1:matrix.org | Awesome! | 14:21:15 |
31 Jan 2020 |
| @layter:matrix.org set a profile picture. | 04:58:41 |
3 Feb 2020 |
| @underoot:matrix.org joined the room. | 08:53:06 |
4 Feb 2020 |
| himself65 joined the room. | 18:18:42 |
5 Feb 2020 |
| azaeres joined the room. | 00:11:37 |
| azaeres set a profile picture. | 01:58:30 |
6 Feb 2020 |
| @mangiacaprini:matrix.org joined the room. | 06:28:46 |
| leandro joined the room. | 21:41:02 |
7 Feb 2020 |
| @legendecas:matrix.org joined the room. | 03:34:23 |