@esign/json-fetcher
v1.1.2
Published
NPM package for managing data from an API.
Downloads
5
Readme
jsonFetcher
NPM package for managing data from an API.
Installation
Install package:
npm i @esign/json-fetcher
Import package in Javascript file:
import JsonFetcher from '@esign/json-fetcher';
Create new JsonFetcher instance:
const instance = new JsonFetcher();
Pass options to JsonFetcher class:
const instance = new JsonFetcher({
element: '.js-json-fetcher',
template: '.js-json-fetcher__template',
api: API_URL,
keys: ['url', 'photo'],
});
Replace API_URL with your api url
Options:
| property | default | attribute-way | | -------- | ------------------------------ | ------------- | | element | null | / | | template | '.js-json-fetcher__template' | / | | api | null | 'data-api' | | keys | null | 'data-keys' |