-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node emits "online" event once online #93
Conversation
src/index.js
Outdated
@@ -187,6 +187,8 @@ class Node extends EventEmitter { | |||
return each(this.modules.discovery, (d, cb) => d.start(cb), cb) | |||
} | |||
cb() | |||
|
|||
this.emit('online') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, "online" is somewhat ambiguous, and not the goal. I'd say started and stopped are what are the really important events for the user (at the libp2p and ifs levels).
Following that trail, I think this leads to replacing .isOnline()
with .isStarted()
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pgte I like that :) (maybe isRunning
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should use the same verbs, otherwise it may get confusing to users, no?
The other alternative is to be explicit (in the docs) about the state machine (states) and the transitions (events). Example:
starting event -> starting state -> started event -> running state -> stopping event -> stopped state
Makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽
* feat: convergence * structure examples
As discussed, switched to "start" and "stop" events. Also, replaced |
Rebased PR after opening, now GH is all confused about the diff. Closing this one to create a new PR.. |
Bumps [it-length-prefixed](https://github.com/alanshaw/it-length-prefixed) from 2.0.0 to 3.0.0. - [Release notes](https://github.com/alanshaw/it-length-prefixed/releases) - [Changelog](https://github.com/alanshaw/it-length-prefixed/blob/master/CHANGELOG.md) - [Commits](alanshaw/it-length-prefixed@v2.0.0...v3.0.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
To support ipfs/js-ipfs#891