proper-on-transition-end

0.3.1 • Public • Published

proper-on-transition-end

NPM version Downloads Build Status Coverage Status Dependency status Dev Dependency status Greenkeeper badge

Cross-browser transitionend event listener.

This module is based on on-transition-end, which no longer seems to be maintained and is not working properly. Also, it automatically infers the timeout based on the transition duration.

Installation

$ npm install proper-on-transition-end

Usage

import onTransitionEnd from 'proper-on-transition-end';
// or
const onTransitionEnd = window.onTransitionEnd;
 
const cancelOnTransitionEnd = onTransitionEnd(element, [options,] callback)
  • element: The element that is transitioning.
  • options: You can pass a few options here:
    • timeout: This is automatically calculated for you, based on the longest transition of the element, using longest-transition. Still, you can override that and pass the timeout in milliseconds.
    • gracePeriod: There is an implicit grace period of 100 milliseconds before the event times out, but you can tweak it using this option.
  • callback: The callback that is called when the transition ends.

Calling cancelOnTransitionEnd will remove the listener and cleanup the timers.

Tests

$ npm test
$ npm test-cov to get coverage report

License

Released under the MIT License.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.180latest

Version History

VersionDownloads (Last 7 Days)Published
0.3.180
0.3.00
0.2.20
0.2.10
0.2.00
0.1.20
0.1.10
0.1.00

Package Sidebar

Install

npm i proper-on-transition-end

Weekly Downloads

80

Version

0.3.1

License

MIT

Unpacked Size

12.4 kB

Total Files

10

Last publish

Collaborators

  • marcooliveira
  • satazor