Merge pull request #24560 from tomwanzek/d3-fetch-1-1-0

feat(d3-fetch):  update to minor version 1.1
This commit is contained in:
Nathan Shively-Sanders
2018-03-27 13:44:22 -07:00
committed by GitHub
2 changed files with 43 additions and 2 deletions

View File

@@ -49,3 +49,14 @@ promise1 = d3Fetch.tsv(url);
promise1 = d3Fetch.tsv(url, init);
promise2 = d3Fetch.tsv<MyType>(url, parseRow);
promise2 = d3Fetch.tsv<MyType>(url, init, parseRow);
let docPromise: Promise<Document>;
docPromise = d3Fetch.hmtl(url);
docPromise = d3Fetch.hmtl(url, init);
docPromise = d3Fetch.svg(url);
docPromise = d3Fetch.svg(url, init);
let xmlDocPromise: Promise<XMLDocument>;
xmlDocPromise = d3Fetch.xml(url);
xmlDocPromise = d3Fetch.xml(url, init);

View File

@@ -1,10 +1,10 @@
// Type definitions for d3-fetch 1.0
// Type definitions for d3-fetch 1.1
// Project: https://d3js.org/d3-fetch/
// Definitions by: Hugues Stefanski <https://github.com/ledragon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Last module patch version validated against: 1.0.1
// Last module patch version validated against: 1.1.0
import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv';
@@ -146,6 +146,16 @@ export function dsv<ParsedRow extends DSVRowAny>(
row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow | undefined | null
): Promise<DSVParsedArray<ParsedRow>>;
/**
* Fetches the file at the specified input URL as text, parses it as HTML and returns a Promise of an HTML DOM Document.
*
* If init is specified, it is passed along to the underlying call to fetch.
*
* @param url A valid URL string.
* @param init An optional request initialization object.
*/
export function hmtl(url: string, init?: RequestInit): Promise<Document>;
/**
* Fetches the image at the specified input URL and returns a promise of an HTML image element.
*
@@ -168,6 +178,16 @@ export function image(url: string, init?: {[key: string]: any}): Promise<HTMLIma
*/
export function json<ParsedJSONObject extends any>(url: string, init?: RequestInit): Promise<ParsedJSONObject>;
/**
* Fetches the file at the specified input URL as text, parses it as SVG and returns a Promise of an SVG Document.
*
* If init is specified, it is passed along to the underlying call to fetch.
*
* @param url A valid URL string.
* @param init An optional request initialization object.
*/
export function svg(url: string, init?: RequestInit): Promise<Document>;
/**
* Fetches the text file at the specified input URL and returns it as a Promise of a string.
*
@@ -234,3 +254,13 @@ export function tsv<ParsedRow extends DSVRowAny>(
init: RequestInit,
row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow | undefined | null
): Promise<DSVParsedArray<ParsedRow>>;
/**
* Fetches the file at the specified input URL as text, parses it as XML and returns a Promise of an XML Document.
*
* If init is specified, it is passed along to the underlying call to fetch.
*
* @param url A valid URL string.
* @param init An optional request initialization object.
*/
export function xml(url: string, init?: RequestInit): Promise<XMLDocument>;