Socket
Socket
Sign inDemoInstall

react-native-smart-timer-enhance

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-smart-timer-enhance

A TimerEnhance for React Native app (es6) which replaced TimerMixin (es5) provides timer functions for executing code in the future that are safely cleaned up when the component unmounts


Version published
Weekly downloads
49
decreased by-57.02%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-smart-timer-enhance

A TimerEnhance for React Native app (es6) which replaced TimerMixin (es5) provides timer functions for executing code in the future that are safely cleaned up when the component unmounts

Inspired by react-timer-mixin

Installation

npm install react-native-smart-timer-enhance --save

Usage

Install the TimerEnhance from npm with npm install react-native-smart-timer-enhance --save. Then, require it from your app's JavaScript files with import TimerEnhance from 'react-native-smart-timer-enhance'.

import React, {
    Component,
} from 'react'

import TimerEnhance from '../../react-native-smart-timer-enhance'

class TimerEnhanceDemo extends Component {

    componentDidMount() {
        this.setTimeout(() => {
            console.log('setTimeout do not leak!');
        }, 3000);
        this.setInterval( () => {
            console.log('setInterval do not leak!');
        }, 1000)
        this.requestAnimationFrame(this._raf)
    }

    render() {
        return null
    }

    _raf = (...p) => {
        console.log('requestAnimationFrame do not leak!');
        this.requestAnimationFrame(this._raf)
    }
}

export default TimerEnhance(TimerEnhanceDemo)

Keywords

FAQs

Package last updated on 20 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc