UNPKG

react-animate-number

Version:
1 lines 1.58 kB
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.ReactAnimateNumber=e()}}(function(){return function e(t,n,i){function r(u,f){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!f&&a)return a(u,!0);if(o)return o(u,!0);var d=new Error("Cannot find module '"+u+"'");throw d.code="MODULE_NOT_FOUND",d}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return r(n?n:e)},l,l.exports,e,t,n,i)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<i.length;u++)r(i[u]);return r}({1:[function(e,t,n){(function(e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,r=i.createClass({displayName:"ReactAnimateNumber",getInitialState:function(){return{number:0}},componentDidMount:function(){var e=this.props,t=e.number,n=e.speed;t&&this.animate(t,n)},componentWillUnmount:function(){clearInterval(this.timer)},animate:function(e,t){this.timer=setInterval(function(){this.state.number<e?this.setState({number:this.state.number+1}):clearInterval(this.timer)}.bind(this),t)},render:function(){var e=this.state.number;return i.createElement("span",null,e)}});n["default"]=r,t.exports=n["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});