Closed mafintosh closed 3 years ago
if we're willing to drop Node 12 and below for v5 all private methods could be implemented as true private methods e.g.:
class HyperDHT extends DHT {
constructor (opts = {}) {
super({ bootstrap: BOOTSTRAP_NODES, ...opts })
this.on('persistent', this.#ondhtpersistent)
}
#ondhtpersistent () {
this.persistent = new PersistentNode(this)
}
}
also we could use instance prop shorthand for both public and private:
class HyperDHT extends DHT {
persistent = null
#somethingPrivate = true
constructor (opts = {}) {
super({ bootstrap: BOOTSTRAP_NODES, ...opts })
this.on('persistent', this.#ondhtpersistent)
}
#ondhtpersistent () {
this.persistent = new PersistentNode(this)
}
}
(node 12 is EOL in 10 months)
@davidmarkclements super down to look at the private props/methods later - merging for now as it should all work now for the RC
Will form the basis for Hyperswarm v5