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

async-render

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

async-render - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

35

lib/index.js

@@ -41,9 +41,3 @@ 'use strict';

value: function componentDidMount() {
var _this2 = this;
var children = this.props.children;
this.idleCallbackId = requestIdleCallback(function () {
return _this2.setState({ children: children });
});
this.requestIdleCallback();
}

@@ -53,4 +47,2 @@ }, {

value: function componentDidUpdate(prevProps, prevState, snapshot) {
var _this3 = this;
var children = this.props.children;

@@ -60,8 +52,27 @@

this.cancelIdleCallback();
this.idleCallbackId = requestIdleCallback(function () {
return _this3.setState({ children: children });
});
this.requestIdleCallback();
}
}
}, {
key: 'requestIdleCallback',
value: function (_requestIdleCallback) {
function requestIdleCallback() {
return _requestIdleCallback.apply(this, arguments);
}
requestIdleCallback.toString = function () {
return _requestIdleCallback.toString();
};
return requestIdleCallback;
}(function () {
var _this2 = this;
var children = this.props.children;
this.idleCallbackId = requestIdleCallback(function () {
return _this2.setState({ children: children });
});
})
}, {
key: 'cancelIdleCallback',

@@ -68,0 +79,0 @@ value: function (_cancelIdleCallback) {

{
"name": "async-render",
"version": "1.0.0",
"version": "1.0.1",
"description": "React Component with *requestIdleCallback*.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -15,4 +15,3 @@ /**

componentDidMount(){
let { children } = this.props;
this.idleCallbackId = requestIdleCallback(()=>this.setState({ children }));
this.requestIdleCallback();
}

@@ -23,5 +22,9 @@ componentDidUpdate(prevProps, prevState, snapshot){

this.cancelIdleCallback();
this.idleCallbackId = requestIdleCallback(()=>this.setState({ children }));
this.requestIdleCallback();
}
}
requestIdleCallback(){
let { children } = this.props;
this.idleCallbackId = requestIdleCallback(()=>this.setState({ children }));
}
cancelIdleCallback(){

@@ -28,0 +31,0 @@ if(this.idleCallbackId){

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