Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 1.09 KB

README.md

File metadata and controls

46 lines (29 loc) · 1.09 KB

@gasket/data

Helper package for accessing embedded Gasket Data in the browser.

Installation

npm i @gasket/data

Usage

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.

Adding Data

To add to the data exposed in @gasket/data, see the @gasket/plugin-data documentation and the publicGasketData lifecycle.

License

MIT