# snabbdom-delayed-class

> Snabbdom class module with support for delayed/on-remove class updates

Latest version **0.1.1** (published 2016-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install snabbdom-delayed-class
pnpm add snabbdom-delayed-class
yarn add snabbdom-delayed-class
bun add snabbdom-delayed-class
```

## 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.1.1 |
| Published | 2016-12-19 |
| First published | 2016-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ted Dumitrescu |
| Maintainers | tdumitrescu |
| Keywords | snabbdom, class, module |

## Links

- npm: https://www.npmjs.com/package/snabbdom-delayed-class
- Repository: https://github.com/tdumitrescu/snabbdom-delayed-class
- Homepage: https://github.com/tdumitrescu/snabbdom-delayed-class#readme
- Issues: https://github.com/tdumitrescu/snabbdom-delayed-class/issues
- npm.io page: https://npm.io/package/snabbdom-delayed-class

## Recent versions

- 0.1.1 (latest) — 2016-12-19
- 0.1.0 — 2016-12-19

## README

# snabbdom-delayed-class

Replacement module for [Snabbdom's core `class` module](https://github.com/snabbdom/snabbdom#the-class-module). It is backwards-compatible with the existing module, but adds functionality for delaying class updates and updating classes before removing elements, similar to [the core `style` module](https://github.com/snabbdom/snabbdom#delayed-properties). These capabilities are useful for constructing animations using CSS classes/stylesheets, instead of inline styles.

## Installation/usage

Install package: `npm install --save snabbdom-delayed-class`

Import/require `snabbdom-delayed-class` and pass it to `snabbdom.init()` instead of the core `class` module:
```js
import snabbdom from 'snabbdom';
import snabbDelayedClass from 'snabbdom-delayed-class';

const patch = snabbdom.init([
  snabbDelayedClass,
  // other modules
]);
```

### Delayed classes

Classes under `delayed` are not changed until the next frame:
```js
h('div', {class: {
  fadedout: true,
  delayed: {fadedout: false},
}, 'Fading in');
```

### Set classes on remove/destroy

Class changes under `remove` are applied when the element is about to be removed from the DOM. The `delayRemove` property specifies the number of milliseconds to wait before removing the element (to permit any CSS transitions or animations to finish):
```js
h('div', {class: {
  fadedout: false,
  remove: {fadedout: true, delayRemove: 300},
}, 'Fading out');
```

The `destroy` property works similarly but has no `delayRemove` property; it is assumed that removal delay will be managed by the ancestor node whose removal caused the `destroy` call on descendents.

## Local development

- `npm install`
- `npm test`

## License

MIT

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