-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserialHelper.js
More file actions
46 lines (44 loc) · 848 Bytes
/
serialHelper.js
File metadata and controls
46 lines (44 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* Serial number and serial manager.
*
*
* @class
**/
const SerialHelperClass = class{
/** @type {StorageHelperClass} **/
#sT = new StorageHelperClass();
/** @type {string} **/
#name = '';
/** @type {string} **/
#sn = '';
/**
*
* @param {string} // @param {str}
* @constructs
**/
constructor(name_) {
this.#name = (name_).toString();
this.#sn = (
'serializer_'+
(name_).toString()
);
};
/**
*
* @public
* @return {number}// {uint16_t}
**/
async get(){
return await this.#sT.get(this.#sn, 0);
};
/**
*
* @public
* @return {number}// {uint16_t}
**/
async step(){
const val = await this.get();
await this.#sT.set(this.#sn, (val+1));
return val;
};
};