mirror of https://github.com/waku-org/nwaku.git
enhancement/init-function-signature-type (#93)
This commit is contained in:
parent
4745135ee6
commit
2d6c5ae9a1
|
@ -13,7 +13,7 @@ five method are:
|
|||
5. **Query** - for historical messages.
|
||||
|
||||
```Nim
|
||||
proc init*(conf: WakuNodeConf): Future[WakuNode]
|
||||
proc init*(T: type WakuNode, conf: WakuNodeConf): Future[T]
|
||||
## Creates and starts a Waku node.
|
||||
##
|
||||
## Status: Implemented.
|
||||
|
|
|
@ -18,7 +18,7 @@ let conf = WakuNodeConf.load()
|
|||
# Node operations happens asynchronously
|
||||
proc runBackground(conf: WakuNodeConf) {.async.} =
|
||||
# Create and start the node
|
||||
let node = await init(conf)
|
||||
let node = await WakuNode.init(conf)
|
||||
|
||||
# Subscribe to a topic
|
||||
let topic = "foobar"
|
||||
|
|
|
@ -223,7 +223,7 @@ proc start*(node: WakuNode, conf: WakuNodeConf) {.async.} =
|
|||
## Public API
|
||||
##
|
||||
|
||||
method init*(conf: WakuNodeConf): Future[WakuNode] {.async.} =
|
||||
method init*(T: type WakuNode, conf: WakuNodeConf): Future[T] {.async.} =
|
||||
## Creates and starts a Waku node.
|
||||
##
|
||||
let node = await createWakuNode(conf)
|
||||
|
@ -313,5 +313,5 @@ method query*(w: WakuNode, query: HistoryQuery): HistoryResponse =
|
|||
|
||||
when isMainModule:
|
||||
let conf = WakuNodeConf.load()
|
||||
discard init(conf)
|
||||
discard WakuNode.init(conf)
|
||||
runForever()
|
||||
|
|
Loading…
Reference in New Issue