enhancement/init-function-signature-type (#93)

This commit is contained in:
Dean Eigenmann 2020-07-28 12:28:32 +02:00 committed by GitHub
parent 4745135ee6
commit 2d6c5ae9a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -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.

View File

@ -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"

View File

@ -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()