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

'Promised' settings #2

Open
benel opened this issue Dec 12, 2019 · 2 comments
Open

'Promised' settings #2

benel opened this issue Dec 12, 2019 · 2 comments
Labels

Comments

@benel
Copy link
Member

benel commented Dec 12, 2019

Hypertopic settings are got:

  • from a database (in LaSuli),
  • from a file (in Porphyry).

If the Hypertopic constructor could accept promises, development would be easier.

@benel benel added the feature label Dec 12, 2019
@benel
Copy link
Member Author

benel commented Dec 12, 2019

Examples of use:

From local storage

const DB = new Hypertopic(browser.storage.local.get('services'));

instead of

const DB = browser.storage.local.get('services')
  .then(x => x.services)
  .then(x => new Hypertopic(x));

From a file

const DB = new Hypertopic(fetchYAML('./config.yml'));

instead of

const DB = fetch('./config.yml')
  .then(x => x.text())
  .then(x => yaml.parse(x))
  .then(x => x.services)
  .then(x => new Hypertopic(x));

@benel
Copy link
Member Author

benel commented Dec 12, 2019

Or maybe, integration of the services step would be enough:

const DB = browser.storage.local.get('services')
  .then(x => new Hypertopic(x));
const DB = (fetchYAML('./config.yml')
  .then(x => new Hypertopic(x));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant