mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
Use boolean type for manualAddContacts with ternary conversion
Keep setAutoAddContacts/setManualAddContacts passing true/false as originally intended. Convert to 0/1 at the writeByte boundary using a ternary operator.
This commit is contained in:
parent
2d4cb35e51
commit
43e25b4acb
1 changed files with 5 additions and 5 deletions
|
|
@ -475,13 +475,13 @@ class Connection extends EventEmitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {number} manualAddContacts
|
||||
* @param {boolean} manualAddContacts
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async sendCommandSetOtherParams(manualAddContacts) {
|
||||
const data = new BufferWriter();
|
||||
data.writeByte(Constants.CommandCodes.SetOtherParams);
|
||||
data.writeByte(manualAddContacts); // 0 or 1
|
||||
data.writeByte(manualAddContacts ? 1 : 0);
|
||||
await this.sendToRadioFrame(data.toBytes());
|
||||
}
|
||||
|
||||
|
|
@ -2569,7 +2569,7 @@ class Connection extends EventEmitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {number} manualAddContacts
|
||||
* @param {boolean} manualAddContacts
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
setOtherParams(manualAddContacts) {
|
||||
|
|
@ -2605,12 +2605,12 @@ class Connection extends EventEmitter {
|
|||
|
||||
/** @returns {Promise<void>} */
|
||||
async setAutoAddContacts() {
|
||||
return await this.setOtherParams(0);
|
||||
return await this.setOtherParams(false);
|
||||
}
|
||||
|
||||
/** @returns {Promise<void>} */
|
||||
async setManualAddContacts() {
|
||||
return await this.setOtherParams(1);
|
||||
return await this.setOtherParams(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue