# image-halt

> Preload images with an option to cancel the transfer if needed without stoping

Latest version **0.0.1** (published 2015-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install image-halt
pnpm add image-halt
yarn add image-halt
bun add image-halt
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2015-05-31 |
| First published | 2015-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Noel Delgado |
| Maintainers | noeldelgado |
| Keywords | image, load, halt, cancel, preload, browser |

## Links

- npm: https://www.npmjs.com/package/image-halt
- Repository: https://github.com/noeldelgado/image-halt
- Homepage: https://github.com/noeldelgado/image-halt#readme
- Issues: https://github.com/noeldelgado/image-halt/issues
- npm.io page: https://npm.io/package/image-halt

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2015-05-31

## README

# image-halt

Preload images with an option to cancel the transfer if needed without stoping
the window loading.

[Read the Specification](https://github.com/noeldelgado/image-halt/wiki/Spec)

## Installation

**NPM**

```sh
npm i image-halt --save
```

## Usage

```js
var ImageHalt = require('image-halt');

var paths = ['a.jpg', 'b.png', 'c.gif'];
var images = [];

function handleImageLoad(err, image) {
	if (err) { // handle the error
		return;
	}
	
	document.body.appendChild(image);
}

// register 
paths.forEach(function(path) {
	images.push( new ImageHalt(path, handleImageLoad).load() );
});

// ...
// later on we cancel them
images.forEach(function(image) {
	if (image.isLoaded() === false) {
		image.abort();
	}
});
```

## Basic Methods

name | description | return
---|---|---
load | Creates a new in-memory image object and start listening for it to load. | self
abort | Cancel the image transfer. | self

## Other Methods

name | description | return
---|---|---
isLoaded | Returns whether or not the image has already been loaded. | Boolean

## License
MIT © [Noel Delgado](http://pixelia.me/)

---
_Source: https://npm.io/package/image-halt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
