0.13.4 • Published 7 years ago

react-timer-mixin v0.13.4

Weekly downloads
214,296
License
MIT
Repository
github
Last release
7 years ago

react-timer-mixin

Using bare setTimeout, setInterval, setImmediate and requestAnimationFrame calls is very dangerous because if you forget to cancel the request before the component is unmounted, you risk the callback throwing an exception.

If you include TimerMixin, then you can replace your calls to setTimeout(fn, 500) with this.setTimeout(fn, 500) (just prepend this.) and everything will be properly cleaned up for you.

Installation

Install the module directly from npm:

npm install react-timer-mixin

Example

var React = require('react');
var TimerMixin = require('react-timer-mixin');

var Component = React.createClass({
  mixins: [TimerMixin],
  componentDidMount() {
    this.setTimeout(
      () => { console.log('I do not leak!'); },
      500
    );
  }
});
@likethemammal/react-primitives@likethemammal/react-primitives_react-native-web_latest@miot-plugin/react-native-deprecated-custom-components@tantei/react-native-scrollable-tab-viewmiot-workspacereact-native-web-dccoapps-frameworkchyuning.react-native-scrollable-tab-view@igen/react-native-scrollable-tab-viewtrustwise-react-nativern-0.45-fork-oreoreact-native-slider-kf@sparted/react-native-webdl-react-native-mock-render@everything-registry/sub-chunk-2618rn-count-up-animationtenvine-scrollable-tab-viewsw-react-native-sliderwu-react-native-scrollable-tab-viewxmly-react-native-scrollable-tab-viewrunnercamp-react-nativerunnercamp-react-native-countdownrunner-camp-shoprunnercamp-shoprn-tipsrmc-react-nativermc-list-view-overflowrmc-list-web-viewrmc-listviewrn-collapsing-tab-barrn-corern-core-lionsrn-webrn-web-lxrn-scrollable-tab-viewrn-snackbarrnviewerrnwcshijingsh-react-native-deprecated-custom-componentssakurasattvareact-web-wiprn-animated-sprite-matrixrn-mock-renderrn-mediarn-echartsrn-packagersuper-duper-rendererscrollable-tab-lmdireact-native-video-trim-pickerreact-native-view-pager-2react-native-view-pager-iberreact-native-view-pager-iberhkreact-native-web-bufferreact-native-web-experimentalreact-native-web-extendedreact-native-web-iereact-native-web-no-typecheckreact-native-web-single-bundlereact-native-web-with-reactreact-native-winjsrh-react-native-scrollable-tab-viewtest-r-componenttest-ray-componentsmsbu-ui-reactsuntfacilisreact-native-web-artlessmelon-native-refreshable-scroll-viewmelon-native-swipergreact-scrollable-tab-viewgohappy-react-nativelistview-webliuyun-react-nativemoles-boilerplatemoles-cuimoles-webjw-components-mobilejst-react-nativekernciftide-clildq-react-native-scrollable-tab-viewlanao-app-scrollable-tab-viewmy-react-native-versionmy_rn_uimy-rnms-react-nativemarathon-uimanbendra-react-nativep-react-native-webprojectzerorn-menuprojectzerorn_react-nativeprnnjlreact-nativephonepenicolastest-react-nativeneil-invento-react-native-mock-renderreact-deadlinereact-native-countupreact-native-desktopreact-native-deprecated-custom-componentreact-native-deprecated-custom-components
0.13.4

7 years ago

0.13.3

9 years ago

0.13.2

10 years ago

0.13.1

10 years ago

0.13.0

10 years ago