From 8c48a945242aa25a8f8f3ee42e65000fa0dbd220 Mon Sep 17 00:00:00 2001 From: William Ngan Date: Thu, 11 Oct 2018 02:20:04 -0700 Subject: [PATCH] Update docs for Util.load --- docs/json/class/Util_Util.json | 4 ++-- src/Util.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/json/class/Util_Util.json b/docs/json/class/Util_Util.json index 9d7a61a3..4b8bbc0f 100644 --- a/docs/json/class/Util_Util.json +++ b/docs/json/class/Util_Util.json @@ -194,7 +194,7 @@ "inherits": false, "signatures": [ { - "comment": "A helper function to load data from a url via XMLHttpRequest GET. If you're loading json data, use standard `JSON.parse(data)` to parse the data. For csv, try using a javascript csv library like papaparse or vega/datalib.", + "comment": "A helper function to load data from a url via XMLHttpRequest GET. Since the response passed into callback is a string, if you're loading json data, you may use standard `JSON.parse(response)` to get a JSON object. For csv, try using a javascript csv library like papaparse or vega/datalib.", "returns": "void", "returns_comment": false, "parameters": [ @@ -206,7 +206,7 @@ }, { "name": "callback", - "comment": "a function to capture the data. It takes two parameters: a `response` as string, and a `success` status as boolean.\n", + "comment": "a function to capture the data. It receives two parameters: a `response` as string, and a `success` status as boolean.\n", "type": " Fn(response:string, success:boolean)", "default": false } diff --git a/src/Util.ts b/src/Util.ts index 6081c061..6a45c907 100644 --- a/src/Util.ts +++ b/src/Util.ts @@ -286,9 +286,9 @@ export class Util { /** - * A helper function to load data from a url via XMLHttpRequest GET. If you're loading json data, use standard `JSON.parse(data)` to parse the data. For csv, try using a javascript csv library like papaparse or vega/datalib. + * A helper function to load data from a url via XMLHttpRequest GET. Since the response passed into callback is a string, if you're loading json data, you may use standard `JSON.parse(response)` to get a JSON object. For csv, try using a javascript csv library like papaparse or vega/datalib. * @param url the request url - * @param callback a function to capture the data. It takes two parameters: a `response` as string, and a `success` status as boolean. + * @param callback a function to capture the data. It receives two parameters: a `response` as string, and a `success` status as boolean. */ static load( url:string, callback:(response:string, success:boolean) => void ) { var request = new XMLHttpRequest();