Skip to content
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

Time to say goodbye to the singleton instance? #24

Closed
vikiival opened this issue Jun 20, 2022 · 2 comments · Fixed by #34
Closed

Time to say goodbye to the singleton instance? #24

vikiival opened this issue Jun 20, 2022 · 2 comments · Fixed by #34
Labels
Milestone

Comments

@vikiival
Copy link
Member

vikiival commented Jun 20, 2022

The singleton instance, rewritten 3 times is with us since summer 2019.
It served well but when you want to have multiple tabs with different chains it's not suitable

What does it cause:

@vikiival
Copy link
Member Author

vikiival commented Jul 8, 2022

Also it would be nice to leverage

HTTP instead of WS
Use WebWorkers?

@vikiival
Copy link
Member Author

First drafts

import { InstantApi as Api } from '../dist/index.mjs'

const url = 'ws://localhost:9944'

async function main() {
  try {
    const api = await new Api(url).getInstance()
    const ss58 = api.consts.system.ss58Prefix.toString()
    console.log('PREFIX', ss58)
  } catch (e) {
    console.log('ERRR', e.target._url)
  }
}

main()

@vikiival vikiival added this to the Api Factory milestone Jul 18, 2022
@vikiival vikiival linked a pull request Jul 26, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant