use-subscription
Advanced tools
Comparing version 0.0.0-8d5403877 to 0.0.0-b4b8a349a
{ | ||
"branch": "master", | ||
"buildNumber": "35115", | ||
"checksum": "1fa61b1", | ||
"commit": "8d5403877", | ||
"buildNumber": "44948", | ||
"checksum": "e1ddacc", | ||
"commit": "b4b8a349a", | ||
"environment": "ci", | ||
"reactVersion": "16.9.0-canary-8d5403877" | ||
"reactVersion": "16.9.0-canary-b4b8a349a" | ||
} |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.0.0-8d5403877 | ||
/** @license React v0.0.0-b4b8a349a | ||
* use-subscription.development.js | ||
@@ -172,4 +172,9 @@ * | ||
return; | ||
} | ||
} // We use a state updater function to avoid scheduling work for a stale source. | ||
// However it's important to eagerly read the currently value, | ||
// so that all scheduled work shares the same value (in the event of multiple subscriptions). | ||
// This avoids visual "tearing" when a mutation happens during a (concurrent) render. | ||
var value = getCurrentValue(); | ||
setState(function (prevState) { | ||
@@ -187,4 +192,2 @@ // Ignore values from stale sources! | ||
var value = getCurrentValue(); | ||
if (prevState.value === value) { | ||
@@ -191,0 +194,0 @@ return prevState; |
@@ -1,2 +0,2 @@ | ||
/** @license React v0.0.0-8d5403877 | ||
/** @license React v0.0.0-b4b8a349a | ||
* use-subscription.production.min.js | ||
@@ -11,4 +11,4 @@ * | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:!0}); | ||
var h=require("react"),l=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,p=function(){try{if(!Object.assign)return!1;var b=new String("abc");b[5]="de";if("5"===Object.getOwnPropertyNames(b)[0])return!1;var c={};for(b=0;10>b;b++)c["_"+String.fromCharCode(b)]=b;if("0123456789"!==Object.getOwnPropertyNames(c).map(function(a){return c[a]}).join(""))return!1;var d={};"abcdefghijklmnopqrst".split("").forEach(function(a){d[a]=a});return"abcdefghijklmnopqrst"!== | ||
Object.keys(Object.assign({},d)).join("")?!1:!0}catch(a){return!1}}()?Object.assign:function(b,c){if(null===b||void 0===b)throw new TypeError("Object.assign cannot be called with null or undefined");var d=Object(b);for(var a,f=1;f<arguments.length;f++){var g=Object(arguments[f]);for(var k in g)m.call(g,k)&&(d[k]=g[k]);if(l){a=l(g);for(var e=0;e<a.length;e++)n.call(g,a[e])&&(d[a[e]]=g[a[e]])}}return d}; | ||
exports.useSubscription=function(b){var c=b.getCurrentValue,d=b.subscribe,a=h.useState(function(){return{getCurrentValue:c,subscribe:d,value:c()}});b=a[0];var f=a[1];a=b.value;if(b.getCurrentValue!==c||b.subscribe!==d)a=c(),f({getCurrentValue:c,subscribe:d,value:a});h.useDebugValue(a);h.useEffect(function(){function a(){b||f(function(a){if(a.getCurrentValue!==c||a.subscribe!==d)return a;var b=c();return a.value===b?a:p({},a,{value:b})})}var b=!1,e=d(a);a();return function(){b=!0;e()}},[c,d]);return a}; | ||
var h=require("react"),l=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,p=function(){try{if(!Object.assign)return!1;var a=new String("abc");a[5]="de";if("5"===Object.getOwnPropertyNames(a)[0])return!1;var c={};for(a=0;10>a;a++)c["_"+String.fromCharCode(a)]=a;if("0123456789"!==Object.getOwnPropertyNames(c).map(function(b){return c[b]}).join(""))return!1;var d={};"abcdefghijklmnopqrst".split("").forEach(function(b){d[b]=b});return"abcdefghijklmnopqrst"!== | ||
Object.keys(Object.assign({},d)).join("")?!1:!0}catch(b){return!1}}()?Object.assign:function(a,c){if(null===a||void 0===a)throw new TypeError("Object.assign cannot be called with null or undefined");var d=Object(a);for(var b,f=1;f<arguments.length;f++){var g=Object(arguments[f]);for(var k in g)m.call(g,k)&&(d[k]=g[k]);if(l){b=l(g);for(var e=0;e<b.length;e++)n.call(g,b[e])&&(d[b[e]]=g[b[e]])}}return d}; | ||
exports.useSubscription=function(a){var c=a.getCurrentValue,d=a.subscribe,b=h.useState(function(){return{getCurrentValue:c,subscribe:d,value:c()}});a=b[0];var f=b[1];b=a.value;if(a.getCurrentValue!==c||a.subscribe!==d)b=c(),f({getCurrentValue:c,subscribe:d,value:b});h.useDebugValue(b);h.useEffect(function(){function b(){if(!a){var b=c();f(function(a){return a.getCurrentValue!==c||a.subscribe!==d||a.value===b?a:p({},a,{value:b})})}}var a=!1,e=d(b);b();return function(){a=!0;e()}},[c,d]);return b}; |
{ | ||
"name": "use-subscription", | ||
"description": "Reusable hooks", | ||
"version": "0.0.0-8d5403877", | ||
"version": "0.0.0-b4b8a349a", | ||
"repository": { | ||
@@ -18,3 +18,3 @@ "type": "git", | ||
"peerDependencies": { | ||
"react": "0.0.0-8d5403877" | ||
"react": "0.0.0-b4b8a349a" | ||
}, | ||
@@ -21,0 +21,0 @@ "devDependencies": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16327
206
0