Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-interval

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-interval - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

bower.json

13

lib/index.js
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
// Babel6 does not hack the default behaviour of ES Modules anymore, so we should export
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var ReactInterval = require('./ReactInterval').default;
var _ReactInterval = require('./ReactInterval');
var _ReactInterval2 = _interopRequireDefault(_ReactInterval);
exports['default'] = _ReactInterval2['default'];
module.exports = exports['default'];
module.exports = ReactInterval;
//# sourceMappingURL=index.js.map
'use strict';
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');

@@ -13,11 +11,13 @@

var _reactLibReactComponentWithPureRenderMixin = require('react/lib/ReactComponentWithPureRenderMixin');
var _ReactComponentWithPureRenderMixin = require('react/lib/ReactComponentWithPureRenderMixin');
var ReactInterval = _react2['default'].createClass({
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ReactInterval = _react2.default.createClass({
displayName: 'ReactInterval',
propTypes: {
callback: _react2['default'].PropTypes.func.isRequired,
enabled: _react2['default'].PropTypes.bool,
timeout: _react2['default'].PropTypes.number
callback: _react2.default.PropTypes.func.isRequired,
enabled: _react2.default.PropTypes.bool,
timeout: _react2.default.PropTypes.number
},

@@ -31,7 +31,5 @@

},
getInitialState: function getInitialState() {
return { enabled: this.props.enabled };
},
componentDidMount: function componentDidMount() {

@@ -42,3 +40,2 @@ if (this.props.enabled) {

},
componentWillReceiveProps: function componentWillReceiveProps(_ref) {

@@ -50,8 +47,8 @@ var enabled = _ref.enabled;

shouldComponentUpdate: _reactLibReactComponentWithPureRenderMixin.shouldComponentUpdate,
shouldComponentUpdate: _ReactComponentWithPureRenderMixin.shouldComponentUpdate,
componentWillUnmount: function componentWillUnmount() {
this.stop();
},
callback: function callback() {

@@ -61,3 +58,2 @@ this.props.callback();

},
start: function start() {

@@ -67,7 +63,5 @@ this.stop();

},
stop: function stop() {
clearTimeout(this.timer);
},
render: function render() {

@@ -83,4 +77,3 @@ if (this.state.enabled) {

exports['default'] = ReactInterval;
module.exports = exports['default'];
exports.default = ReactInterval;
//# sourceMappingURL=ReactInterval.js.map
{
"name": "react-interval",
"version": "1.2.1",
"version": "1.3.0",
"description": "Safe React wrapper for setInterval",

@@ -9,27 +9,19 @@ "main": "lib/index.js",

"gh-pages": "git checkout gh-pages && git rebase origin/master --force-rebase && npm run build && git add . && git commit --amend --no-edit && git push --force && git checkout master",
"build": "parallelshell -w \"npm run build:lib -s\" \"npm run build:example -s\" \"npm run build:bower -s\"",
"build": "parallelshell -w \"npm run build:lib -s\" \"npm run build:ghPages -s\" \"npm run build:dist -s\" \"npm run build:min -s\"",
"prebuild": "rimraf lib example build",
"build:lib": "babel src --out-dir lib --source-maps --ignore src/example",
"build:example": "webpack --config webpack.config.js",
"build:bower": "webpack --config webpack.config.bower.js",
"prepublish": "npm run build -s",
"start": "webpack-dev-server --config webpack.config.development.js",
"lint": "eslint --cache .",
"test": "karma start ./karma.conf.js --single-run --reporters nyan",
"test:dev": "karma start ./karma.conf.js --no-single-run --auto-watch --reporters nyan",
"test:cov": "karma start ./karma.conf.js --single-run --reporters coverage",
"coveralls": "minicat reports/coverage/lcov.info | coveralls",
"validate": "npm run lint -s && npm run build -s && npm run test:cov -s",
"build:lib": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps --ignore src/example",
"build:ghPages": "cross-env NODE_ENV=production BUILD=ghPages webpack",
"build:dist": "cross-env NODE_ENV=production BUILD=dist webpack",
"build:min": "cross-env NODE_ENV=production BUILD=min webpack",
"prepublish": "parallelshell -w \"npm run build:lib -s\" \"npm run build:dist -s\" \"npm run build:min -s\"",
"start": "cross-env NODE_ENV=development webpack-dev-server",
"test": "cross-env NODE_ENV=test babel-node test",
"test:dev": "cross-env NODE_ENV=test babel-node test | tap-nyan",
"test:cov": "cross-env NODE_ENV=test babel-node node_modules/isparta/bin/isparta cover --report text --report html --report lcov --dir reports/coverage test",
"test:e2e": "cross-env NODE_ENV=development nightwatch-autorun",
"lint": "eslint --cache .",
"precommit": "npm run lint -s",
"prepush": "npm run validate -s",
"postversion": "git push && git push --tags"
"prepush": "npm run test -s",
"postversion": "git push --follow-tags"
},
"engines": {
"node": ">=0.10"
},
"os": [
"darwin",
"linux",
"win32"
],
"repository": {

@@ -57,38 +49,37 @@ "type": "git",

"peerDependencies": {
"react": "^0.13 || ^0.14"
"react": "^0.14 || ^15"
},
"devDependencies": {
"babel": "^5.8.23",
"babel-core": "^5.8.25",
"babel-eslint": "^4.1.3",
"babel-loader": "^5.3.2",
"coveralls": "^2.11.4",
"eslint": "^1.6.0",
"eslint-loader": "^1.0.0",
"eslint-plugin-react": "^3.5.1",
"html-webpack-plugin": "^1.6.1",
"husky": "^0.10.1",
"inject-loader": "^2.0.1",
"isparta-loader": "^1.0.0",
"jasmine-core": "^2.3.4",
"karma": "^0.13.10",
"karma-coverage": "^0.5.2",
"karma-jasmine": "^0.3.6",
"karma-junit-reporter": "^0.3.7",
"karma-nyan-reporter": "0.2.2",
"karma-phantomjs-launcher": "^0.2.1",
"karma-webpack": "^1.7.0",
"minicat": "^1.0.0",
"mkdirp": "^0.5.1",
"node-libs-browser": "^0.5.3",
"parallelshell": "^2.0.0",
"phantomjs": "^1.9.18",
"react": "^0.14.0",
"react-dom": "^0.14.0",
"react-hot-loader": "^1.3.0",
"rimraf": "^2.4.3",
"tap-xunit": "^1.2.1",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.0"
"babel-cli": "6.7.5",
"babel-core": "6.7.6",
"babel-eslint": "6.0.2",
"babel-loader": "6.2.4",
"babel-plugin-transform-object-rest-spread": "6.6.5",
"babel-plugin-webpack-loaders": "0.4.0",
"babel-preset-es2015": "6.6.0",
"babel-preset-react": "6.5.0",
"codecov.io": "0.1.6",
"cross-env": "1.0.7",
"css-loader": "0.23.1",
"eslint": "2.7.0",
"eslint-loader": "1.3.0",
"eslint-plugin-react": "4.3.0",
"glob": "7.0.3",
"html-webpack-plugin": "2.15.0",
"husky": "0.11.4",
"isparta": "4.0.0",
"json-loader": "0.5.4",
"nightwatch-autorun": "2.3.1",
"parallelshell": "2.0.0",
"react-dom": "15.0.1",
"react": "15.0.1",
"rimraf": "2.5.2",
"sinon": "1.17.3",
"style-loader": "0.13.1",
"tap-nyan": "0.0.2",
"tap-xunit": "1.3.1",
"tape": "4.5.1",
"webpack": "1.12.14",
"webpack-dev-server": "1.14.1"
}
}

@@ -1,14 +0,15 @@

# react-interval
# react-interval [![npm](https://img.shields.io/npm/v/react-interval.svg?style=flat-square)](https://www.npmjs.com/package/react-interval)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/nkbt/help)
[![Gitter](https://img.shields.io/gitter/room/nkbt/help.svg?style=flat-square)](https://gitter.im/nkbt/help)
[![Circle CI](https://circleci.com/gh/nkbt/react-interval.svg?style=svg)](https://circleci.com/gh/nkbt/react-interval)
[![Coverage Status](https://coveralls.io/repos/nkbt/react-interval/badge.svg?branch=master)](https://coveralls.io/r/nkbt/react-interval?branch=master)
[![Dependency Status](https://david-dm.org/nkbt/react-interval.svg)](https://david-dm.org/nkbt/react-interval)
[![devDependency Status](https://david-dm.org/nkbt/react-interval/dev-status.svg)](https://david-dm.org/nkbt/react-interval#info=devDependencies)
[![CircleCI](https://img.shields.io/circleci/project/nkbt/react-interval.svg?style=flat-square&label=nix-build)](https://circleci.com/gh/nkbt/react-interval)
[![AppVeyor](https://img.shields.io/appveyor/ci/nkbt/react-interval.svg?style=flat-square&label=win-build)](https://ci.appveyor.com/project/nkbt/react-interval)
[![Coverage](https://img.shields.io/codecov/c/github/nkbt/react-interval.svg?style=flat-square)](https://codecov.io/github/nkbt/react-interval?branch=master)
[![Dependencies](https://img.shields.io/david/nkbt/react-interval.svg?style=flat-square)](https://david-dm.org/nkbt/react-interval)
[![Dev Dependencies](https://img.shields.io/david/dev/nkbt/react-interval.svg?style=flat-square)](https://david-dm.org/nkbt/react-interval#info=devDependencies)
Safe React wrapper for setInterval
Safe React wrapper for setInterval
![React Interval](https://cdn.rawgit.com/nkbt/react-interval/master/src/example/react-interval.gif)
![React Interval](./src/example/react-interval.gif)

@@ -18,14 +19,41 @@

### npm
### NPM
```sh
npm install --save react-interval
npm install --save react react-interval
```
### bower
Don't forget to manually install peer dependencies (`react`) if you use npm@3.
### Bower:
```sh
bower install --save react-interval
bower install --save https://npmcdn.com/react-interval/bower.zip
```
or in `bower.json`
```json
{
"dependencies": {
"react-interval": "https://npmcdn.com/react-interval/bower.zip"
}
}
```
then include as
```html
<script src="bower_components/react/react.js"></script>
<script src="bower_components/react-interval/build/react-interval.js"></script>
```
### 1998 Script Tag:
```html
<script src="https://npmcdn.com/react/dist/react.js"></script>
<script src="https://npmcdn.com/react-interval/build/react-interval.js"></script>
(Module exposed as `ReactInterval`)
```
## Demo

@@ -45,3 +73,2 @@

```js
import React from 'react';
import ReactInterval from 'react-interval';

@@ -54,6 +81,2 @@

inc() {
this.setState({count: this.state.count + 1});
},
render() {

@@ -65,3 +88,4 @@ const {count} = this.state;

{count}
<ReactInterval timeout={1000} enabled={true} callback={this.inc} />
<ReactInterval timeout={1000} enabled={true}
callback={() => this.setState({count: this.state.count + 1})} />
</div>

@@ -78,2 +102,3 @@ );

import React from 'react';
import ReactDOM from 'react-dom';
import ReactInterval from 'react-interval';

@@ -90,6 +115,2 @@

inc() {
this.setState({count: this.state.count + 1});
},
render() {

@@ -100,3 +121,4 @@ const {timeout, enabled, count} = this.state;

<div>
<ReactInterval {...{timeout, enabled}} callback={this.inc} />
<ReactInterval {...{timeout, enabled}}
callback={() => this.setState({count: this.state.count + 1})} />

@@ -117,2 +139,6 @@ <input type="number" step="200" min="200" max="5000" value={this.state.timeout}

});
const appRoot = document.createElement('div');
document.body.appendChild(appRoot);
ReactDOM.render(<App />, appRoot);
```

@@ -140,10 +166,14 @@

Currently is being developed and tested with the latest stable `Node 5` on `OSX` and `Windows`.
Should be ok with Node 4, but not guaranteed.
To run example covering all `ReactInterval` features, use `npm start`, which will compile `src/example/Example.js`
```bash
git clone git@github.com:nkbt/react-interval.git
cd react-interval
npm install
npm start
```
Then
```bash
# then
open http://localhost:8080

@@ -154,7 +184,14 @@ ```

Only UI tests for now, see [demo](http://nkbt.github.io/react-interval/example)
```bash
npm test
# to run tests in watch mode for development
npm run test:dev
# to generate test coverage (./reports/coverage)
npm run test:cov
```
## License
MIT

@@ -1,4 +0,6 @@

import ReactInterval from './ReactInterval';
'use strict';
// Babel6 does not hack the default behaviour of ES Modules anymore, so we should export
const ReactInterval = require('./ReactInterval').default;
export default ReactInterval;
module.exports = ReactInterval;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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