this
JS-010517 }
18 }
19 }
20 private genNonce = (buf: Buffer) => {21 const now = Date.now()
22 let off = utils.writeTimestamp(buf, now, 0)
23 const words = off + (((buf.length - off) / 4) | 0) * 4
16 return await this.verify(nonce, session.difficulty, session.prefix)
17 }
18
19 public getProblem = (): { prefix: string } => {20 return {
21 prefix: randomstring.generate({ length: 16, charset: 'hex' }),
22 }
62 })
63 }
64
65 private parseNumString = (numString: string) => { 66 const substrings = numString.split(',')
67 const numArr: number[] = []
68 substrings.forEach(function (item) {
If a class method does not use this
, it can sometimes be made into a static function. If you do convert the method into a static function, instances of the class that call that particular method have to be converted to a static call as well (MyClass.callStaticMethod())
class Person {
sayHi() {
const greeting = document.createElement("div");
greeting.innerText = "Hello!";
document.appendChild();
}
}
const person = new Person();
person.sayHi();
class Person {
static sayHi() {
const greeting = document.createElement("div");
greeting.innerText = "Hello!";
document.appendChild();
}
}
Person.sayHi();