3.8.4 • Published 1 year ago

data-loader v3.8.4

Weekly downloads
412
License
Apache-2.0
Repository
github
Last release
1 year ago

data-loader

A standard Custom Element fetching data declaratively.

It follows the current v1 draft.

Will load the data at the URL defined in the src property of a source element that it contains.

It can also parse JSON from the content of a script tag of type application/json.

Usage

Example

<data-loader>
  <source src="https://www.example.com/some/data" />
</data-loader>

See it running Here.

Use with custom namespace

Only needed if the data-loader name clashes with an other existing Custom Element.

import DataLoader from "data-loader";

// Register the Custom Elements
customElements.define("namespaced-data-loader", DataLoader);

And then in the HTML, use like so:

<namespaced-data-loader>
  <source src="https://www.example.com/some/data" />
</namespaced-data-loader>

Compatibility

This element assumes support for at least ES2015. To support older browsers you might need to transpile the code you use down to the version you are planning on supporting.

You might need to use a polyfill for browsers not supporting Custom Elements v1 (not v0). See webcomponents.js or SkateJS Web Components.

API

To be completed

Properties

namedefault valueinformationDOM attributewritable
datanulldata loaded by the component (same than the data dispatched in the load event)nono
loadedfalseflag informing if data is currently loadednono
selectornullselector to extract data from the payload (see lodash.get documentation)yesno

Events

event nameinformation
errorFired when none of the URL defined in the source elements is reachable nor returns a valid response
loadFired when a URL returns a valid response, contains the data loaded (same as data property)
3.8.4

1 year ago

3.5.7

2 years ago

3.0.0

4 years ago

3.0.0-alpha.21

4 years ago

2.12.0

4 years ago

2.11.0

4 years ago

2.9.0

4 years ago

2.9.1

4 years ago

2.5.1

4 years ago

2.4.2

4 years ago

2.3.0

4 years ago

2.1.12

5 years ago

2.0.4

5 years ago

2.0.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0-beta.9

5 years ago

1.0.0-beta.4

5 years ago

1.0.0-beta.3

5 years ago

1.0.0-beta.2

5 years ago

1.0.0-beta.1

5 years ago

1.0.8-alpha.0

6 years ago

1.0.7-alpha.0

6 years ago

1.0.6-alpha.0

6 years ago

1.0.5-alpha.0

6 years ago

1.0.4-alpha.0

6 years ago

1.0.3-alpha.0

6 years ago

1.0.2-alpha.0

6 years ago

1.0.1-alpha.0

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.0

6 years ago

0.2.0

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago