Skip to content
Small fn that resolves a Promise when a CSS animation completes.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
dist
test
.gitignore
.npmignore
.publishrc
build.js
package-lock.json
package.json
readme.md
src.js

readme.md

Animation Resolve

Small module I often use with Mithril.js and onbeforeremove() to animate a component before removing it from the DOM.

This module (ESM and CJS) supplies a function that returns a Promise which resolves when a CSS animation completes after updating a DOM nodes CSS class.

With Mithril

.animateOut {
    animation: forwards 0.5s animateOut;
}

@keyframes animateOut {
    100% {
        opacity: 0;
    }
}
import animationResolve from "animation-resolve";

export default {
    onbeforeremove(vnode) {
        return animationResolve(vnode.dom, "animateOut");
    },
    view() {
        return m("div", "animates out");
    }
}
You can’t perform that action at this time.