1.7.4 • Published 6 years ago

@pearlbea/better-img-stencil v1.7.4

Weekly downloads
4
License
-
Repository
-
Last release
6 years ago

better-img-stencil

A simple component that adds a fallback url and logging function to an image. Made with Stencil Component Starter.

Installation

Install the npm package or add the script from unkpg to your HTML page. Example:

<!-- load the element from unkpg -->
<script src="https://unpkg.com/@pearlbea/better-img-stencil@1.2.8/dist/better-img-stencil.js"></script>

<!-- or from node modules -->
<script src="../node_modules/@pearlbea/better-img/src/better-img/dist/better-img-stencil.js"></script>

<!-- use the component on your page -->
<better-img-stencil
  url="https://placeimg.com/480/640/animals"
  fallback="https://lorempixel.com/480/640"
  log="logMe"
  width="480"
  height="640"
  alt="an adorable animal">
</better-img-stencil>

Usage

propertytypedefaultdescription
url (required)stringnullAn image url. This will become the image's "src" attribute.
fallbackstringnullAn image url. If the url provided returns an error, the fallback url will be assigned to the "src" attribute.
widthnumber480Image width
heightnumber640Image height
altstring""Image alt text
logstringnullIf you provide the name of a function, it will be called if the url returns an error and receive the error object as a parameter.

Viewing your component

$ npm run dev

Running the tests

$ npm test

See the Stencil testing docs and Jest for more info.

License

MIT

1.7.4

6 years ago

1.7.3

6 years ago

1.7.0

6 years ago

1.5.4

6 years ago

1.5.1

6 years ago

1.6.0

6 years ago

1.5.0

6 years ago

1.4.6

6 years ago

1.4.5

6 years ago

1.4.4

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

0.0.1

6 years ago