How to use the d3-fetch.image function in d3-fetch

To help you get started, we’ve selected a few d3-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / d3-fetch / d3-fetch-tests.ts View on Github external
const url = 'foo.bar';

const init: RequestInit = {};

let p1: Promise = d3Fetch.blob(url);
p1 = d3Fetch.blob(url, init);

let p2: Promise = d3Fetch.buffer(url);
p2 = d3Fetch.buffer(url, init);

let p3: Promise = d3Fetch.image(url);
const imageProperties = {
    width: '300px',
    height: '500px'
};
p3 = d3Fetch.image(url, imageProperties);

let p4: Promise = d3Fetch.json(url);
p4 = d3Fetch.json(url, init);
let p5: Promise = d3Fetch.json(url);
p5 = d3Fetch.json(url, init);

let myString: Promise;
myString = d3Fetch.text(url);
myString = d3Fetch.text(url, init);

const parseRow = (rawRow: DSVRowString, index: number, columns: string[]): (MyType | undefined | null) => {
    const myType: MyType | null = rawRow['foo'] ? { foo: rawRow['foo'] + '+ bar' } : null;
    return myType;
};
let promise1: Promise>;
let promise2: Promise>;
github DefinitelyTyped / DefinitelyTyped / types / d3-fetch / d3-fetch-tests.ts View on Github external
interface MyType {
    foo: string;
}

const url = 'foo.bar';

const init: RequestInit = {};

let p1: Promise = d3Fetch.blob(url);
p1 = d3Fetch.blob(url, init);

let p2: Promise = d3Fetch.buffer(url);
p2 = d3Fetch.buffer(url, init);

let p3: Promise = d3Fetch.image(url);
const imageProperties = {
    width: '300px',
    height: '500px'
};
p3 = d3Fetch.image(url, imageProperties);

let p4: Promise = d3Fetch.json(url);
p4 = d3Fetch.json(url, init);
let p5: Promise = d3Fetch.json(url);
p5 = d3Fetch.json(url, init);

let myString: Promise;
myString = d3Fetch.text(url);
myString = d3Fetch.text(url, init);

const parseRow = (rawRow: DSVRowString, index: number, columns: string[]): (MyType | undefined | null) => {