Helper package for accessing embedded Gasket Data in the browser.
npm i @gasket/data
This helper is intended for use in conjunction with Gasket Data embedded in a script tag in the HTML document.
For example, if the following data is rendered...
<script id="GasketData" type="application/json">{ "something": "interesting" }</script>
...then it would be accessible as:
import { gasketData } from '@gasket/data';
console.log(gasketData().something); // interesting
Note that @gasket/data
is only expected to be used in the browser, and not in
server-side code.
To add to the data exposed in @gasket/data
, see the @gasket/plugin-data documentation and the publicGasketData lifecycle.