Sha256: 3cd7b04861cee32f184caa57149086d0b19581073bad801881dc741a40f0fde7
Contents?: true
Size: 571 Bytes
Versions: 4
Compression:
Stored size: 571 Bytes
Contents
/* eslint-disable no-unused-vars */ // Outside of the closure to make it public let DATACHARTS = null; const fetchDatacharts = () => { const metrics = [{ key: "NAME_TO_BE_IN_THE_HTML-1", query: "GRAPHQL_QUERY-1" }, { key: "NAME_TO_BE_IN_THE_HTML-2", query: "GRAPHQL_QUERY-2" }] const fetch = (query) => $.post("<-- GRAPHQL_URL -->", query) const promises = metrics.map((metric) => fetch(metric.query).then((response) => { DATACHARTS[metric.key] = response return DATACHARTS })) Promise.all(promises).then(() => DATACHARTS) }
Version data entries
4 entries across 4 versions & 1 rubygems