Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Improve network state callback #373

Open
happybeing opened this issue Jun 11, 2019 · 0 comments
Open

Improve network state callback #373

happybeing opened this issue Jun 11, 2019 · 0 comments

Comments

@happybeing
Copy link

When calling safe.initialiseApp() a callback can be provided to report changes in network state. These appear to be returned as strings (I see 'Connected' on successful init for example) and are presumably set here:

https://github.com/maidsafe/safe_app_nodejs/blob/83a5bc47575270723c2fa748cde104d0ec770250/src/app.js#L479-L497

Issues:

  • the 'state' type/values are not documented in the API docs for initialiseApp()
  • network state is set using 'magic' values in the code above (and not part of the internal consts - see above)
  • network state values are not available to the app for comparison and should be exposed on safe.CONSTANTS (actually I think a lot is probably missing from here)
  • reporting network state using numeric codes rather than strings may be preferable, e.g. it may simplify localisation in apps. In general I don't think reporting state using strings is a good idea, but maybe that's a personal preference.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant