# layout-queue

> A queue for javascript actions that affect layout, which need to execute on browser window resize and need to execute in a specific order.

Latest version **1.0.0** (published 2017-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install layout-queue
pnpm add layout-queue
yarn add layout-queue
bun add layout-queue
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-08-30 |
| First published | 2017-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dave Toews |
| Maintainers | davejtoews |
| Keywords | layout, queue, window, resize |

## Links

- npm: https://www.npmjs.com/package/layout-queue
- Repository: https://github.com/davejtoews/layout-queue
- Homepage: https://github.com/davejtoews/layout-queue#readme
- Issues: https://github.com/davejtoews/layout-queue/issues
- npm.io page: https://npm.io/package/layout-queue

## Dependencies (1)

- [webpack](https://npm.io/package/webpack.md) ^3.5.5

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-08-30
- 0.1.1 — 2017-01-27
- 0.1.0 — 2017-01-27

## README

# Layout Queue

This library was created to eliminate race conditions when multiple JavaScript applied style changes need to occur on window resize. By adding actions to the queue it can be assured that each action will be called in the order they were added every time the queue is triggerd. By default the queue will execute on window load and window resize, but additional triggers can be added, for example on the loading of ajax content that affects the layout. 

##  Installation

Install via npm (or yarn), or copy bundle.js to your project and include via a script tag.

    npm install layout-queue

OR

	yarn add layout-queue

OR

	<script src="path/to/file/bundle.js">

## Use

Add a function to the queue with the `add()` method, by passing in the function and an array of it's argument.

    LayoutQueue.add(nameOfYourFunction, [argument1, argument2]);

### Adding other triggers

If you need the queue to execute on other events, for example when loading ajax content, or when an iframe is loaded, the `trigger()` method can be used. Example:

    document.querySelectorAll('iframe').forEach(function(element) {
        element.addEventListener('load', function() {
            LayoutQueue.trigger();
        });
    });

### Additional methods

    LayoutQueue.list() // Returns an array of queued functions.
    LayoutQueue.clear() // Empties the queue.

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