Add binding to _fetchJSON call

Change-Id: I4f9ad7d7de2795aa4ec5e4a36aa59a001c7640f4
This commit is contained in:
Dhruv Srivastava
2019-09-12 15:47:09 +02:00
parent 146a004b0c
commit b029621426

View File

@@ -53,8 +53,12 @@
GrPluginRestApi.prototype.fetchJSON = function(req) {
// TODO(dhruvsri): find better implementation for fetchJSON
const api = getRestApi();
const fetchJSON = api._fetchJSON ||
api._restApiHelper.fetchJSON.bind(api._restApiHelper);
let fetchJSON;
if (api._fetchJSON) {
fetchJSON = api._fetchJSON.bind(api);
} else {
fetchJSON = api._restApiHelper.fetchJSON.bind(api._restApiHelper);
}
return fetchJSON(req);
};