mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
Restore lost comments, use literal union for AdvertParsedData.type, remove partial event overloads
- Restore behavioral descriptions for sendCommandExportContact and getNeighbours - Use string literal union for AdvertParsedData.type and Advert.getTypeString() - Remove on/once/off overrides that provided minimal type-safety value
This commit is contained in:
parent
7fbf737631
commit
af262cd21b
3 changed files with 7 additions and 80 deletions
|
|
@ -58,7 +58,7 @@ class Advert {
|
|||
return flags & 0x0F;
|
||||
}
|
||||
|
||||
/** @returns {string | null} */
|
||||
/** @returns {"NONE" | "CHAT" | "REPEATER" | "ROOM" | null} */
|
||||
getTypeString() {
|
||||
const type = this.getType();
|
||||
if(type === Advert.ADV_TYPE_NONE) return "NONE";
|
||||
|
|
|
|||
|
|
@ -275,6 +275,8 @@ class Connection extends EventEmitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Provide a public key to export that contact.
|
||||
* Not providing a public key will export local identity as a contact instead.
|
||||
* @param {Uint8Array | null} [pubKey]
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
|
|
@ -863,84 +865,6 @@ class Connection extends EventEmitter {
|
|||
|
||||
// --- High-level API methods ---
|
||||
|
||||
/**
|
||||
* @overload
|
||||
* @param {"connected"} event
|
||||
* @param {() => void} callback
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param {"disconnected"} event
|
||||
* @param {() => void} callback
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param {number} event
|
||||
* @param {(data: any) => void} callback
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @param {string | number} event
|
||||
* @param {Function} callback
|
||||
*/
|
||||
on(event, callback) {
|
||||
super.on(event, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* @overload
|
||||
* @param {"connected"} event
|
||||
* @param {() => void} callback
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param {"disconnected"} event
|
||||
* @param {() => void} callback
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param {number} event
|
||||
* @param {(data: any) => void} callback
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @param {string | number} event
|
||||
* @param {Function} callback
|
||||
*/
|
||||
once(event, callback) {
|
||||
super.once(event, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* @overload
|
||||
* @param {"connected"} event
|
||||
* @param {() => void} callback
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param {"disconnected"} event
|
||||
* @param {() => void} callback
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param {number} event
|
||||
* @param {(data: any) => void} callback
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @param {string | number} event
|
||||
* @param {Function} callback
|
||||
*/
|
||||
off(event, callback) {
|
||||
super.off(event, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Milliseconds | null} [timeoutMillis]
|
||||
* @returns {Promise<SelfInfo>}
|
||||
|
|
@ -2614,6 +2538,9 @@ class Connection extends EventEmitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* REQ_TYPE_GET_NEIGHBOURS from Repeater role.
|
||||
* Repeater must be running firmware v1.9.0+.
|
||||
* @see https://github.com/meshcore-dev/MeshCore/pull/833
|
||||
* @param {Uint8Array} publicKey
|
||||
* @param {number} [count]
|
||||
* @param {number} [offset]
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@
|
|||
|
||||
/**
|
||||
* @typedef {object} AdvertParsedData
|
||||
* @property {string | null} type
|
||||
* @property {"NONE" | "CHAT" | "REPEATER" | "ROOM" | null} type
|
||||
* @property {number | null} lat
|
||||
* @property {number | null} lon
|
||||
* @property {string | null} name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue