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

Async await with d3 fetch functions? #25

Closed
axdyng opened this issue Aug 12, 2018 · 1 comment
Closed

Async await with d3 fetch functions? #25

axdyng opened this issue Aug 12, 2018 · 1 comment

Comments

@axdyng
Copy link

axdyng commented Aug 12, 2018

Hi, is it not possible to use Async/Await with d3-fetch?

i tried doing this:

import * as d3Fetch from "d3-fetch";

async getData() {
     const india = await d3Fetch.json('/data/IND.json');

     return india;
    },

it returned a Promise instead.

PS: currently, i have to save .geojson as .json file format. Feels counter-intuitive? Any plans to add support to read .geojson files?

@mbostock
Copy link
Member

Async-await works great with d3-fetch and we use it in Observable regularly. Here is an example I found:

https://beta.observablehq.com/@jermspeaks/async-await

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

No branches or pull requests

2 participants