Comparing version 0.1.4 to 0.1.5
@@ -1,3 +0,3 @@ | ||
self.uhooksFX=function(e){"use strict";var t=Promise;let n=null,s=new Set;const l=new WeakMap,o=e=>{const{$:t,r:n,h:s}=e;f(n)&&(c.get(s).delete(e),n()),f(e.r=t())&&c.get(s).add(e)},u=()=>{const e=s;s=new Set,e.forEach(d)},c=new WeakMap,a=[],r=[];function h(e,t){return e!==this[t]}const i=()=>l.get(n),f=e=>"function"==typeof e,p=e=>{const t={h:s,c:null,a:null,e:0,i:0,s:[]};return l.set(s,t),s;function s(){const l=n;n=s,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{n=l,a.length&&y.then(a.forEach.bind(a.splice(0),o)),r.length&&r.splice(0).forEach(o)}}},d=({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)},y=new t((e=>e()));function g(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach(d))}const w=(e,t)=>{const n=i(),{i:s,s:l}=n;return s!==l.length&&t&&!t.some(h,l[s]._)||(l[s]={$:e(),_:t}),l[n.i++].$},_=e=>(t,n)=>{const s=i(),{i:l,s:o,h:u}=s,a=l===o.length;a&&(c.has(u)||c.set(u,new Set),o.push({$:t,_:n,r:null,h:u}));const r=o[s.i++];(a||!n||n.some(h,r._))&&e.push(r)},v=_(a),E=_(r),$=(e,t)=>f(t)?t(e):t,k=(e,t,n)=>{const l=i(),{i:o,s:c}=l;o===c.length&&c.push({$:f(n)?n(t):$(void 0,t),set:t=>{c[o].$=e(c[o].$,t),(e=>{s.has(e)||(e.e=1,s.add(e),y.then(u))})(l)}});const{$:a,set:r}=c[l.i++];return[a,r]}; | ||
self.uhooksFX=function(e){"use strict";var t=Promise;let n=null,s=new Set;const l=new WeakMap,c=e=>{const{$:t,r:n,h:s}=e;f(n)&&(u.get(s).delete(e),n()),f(e.r=t())&&u.get(s).add(e)},o=()=>{const e=s;s=new Set,e.forEach((({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)}))},u=new WeakMap,a=[],r=[];function h(e,t){return e!==this[t]}const i=()=>l.get(n),f=e=>"function"==typeof e,p=e=>{const t={h:s,c:null,a:null,e:0,i:0,s:[]};return l.set(s,t),s;function s(){const l=n;n=s,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{n=l,a.length&&d.then(a.forEach.bind(a.splice(0),c)),r.length&&r.splice(0).forEach(c)}}},d=new t((e=>e()));function y(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const g=(e,t)=>{const n=i(),{i:s,s:l}=n;return s!==l.length&&t&&!t.some(h,l[s]._)||(l[s]={$:e(),_:t}),l[n.i++].$},w=e=>(t,n)=>{const s=i(),{i:l,s:c,h:o}=s,a=l===c.length;a&&(u.has(o)||u.set(o,new Set),c.push({$:t,_:n,r:null,h:o}));const r=c[s.i++];(a||!n||n.some(h,r._))&&e.push(r)},_=w(a),v=w(r),E=(e,t)=>f(t)?t(e):t,$=(e,t,n)=>{const l=i(),{i:c,s:u}=l;c===u.length&&u.push({$:f(n)?n(t):E(void 0,t),set:t=>{u[c].$=e(u[c].$,t),(e=>{s.has(e)||(e.e=1,s.add(e),d.then(o))})(l)}});const{$:a,set:r}=u[l.i++];return[a,r]}; | ||
/*! (c) Andrea Giammarchi - ISC */ | ||
let S=null,M=null,m=null;const b=new WeakMap,C=(e,t,n,s)=>e?[s[0],l=>{b.has(e)||(b.set(e,0),y.then((()=>{b.delete(e),e.apply(t,n)}))),s[1](l)}]:s;return e.createContext=e=>({_:new Set,provide:g,value:e}),e.dropEffect=e=>{const t=c.get(e);t&&y.then((()=>{t.forEach((e=>{e.r(),e.r=null})),t.clear()}))},e.hasEffect=e=>c.has(e),e.hooked=(e,t)=>p(t?function t(){const[n,s,l]=[S,M,m];[S,M,m]=[t,this,arguments];try{return e.apply(M,m)}finally{[S,M,m]=[n,s,l]}}:e),e.useCallback=(e,t)=>w((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(i()),t),e.useEffect=v,e.useLayoutEffect=E,e.useMemo=w,e.useReducer=(e,t,n)=>C(S,M,m,k(e,t,n)),e.useRef=e=>{const t=i(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>C(S,M,m,(e=>k($,e))(e)),e.wait=y,e}({}); | ||
let k=null,S=null,M=null;const m=new WeakMap,b=(e,t,n,s)=>e?[s[0],l=>{m.has(e)||(m.set(e,0),d.then((()=>{m.delete(e),e.apply(t,n)}))),s[1](l)}]:s;return e.createContext=e=>({_:new Set,provide:y,value:e}),e.dropEffect=e=>{const t=u.get(e);t&&d.then((()=>{t.forEach((e=>{e.r(),e.r=null})),t.clear()}))},e.hasEffect=e=>u.has(e),e.hooked=(e,t)=>p(t?function t(){const[n,s,l]=[k,S,M];[k,S,M]=[t,this,arguments];try{return e.apply(S,M)}finally{[k,S,M]=[n,s,l]}}:e),e.useCallback=(e,t)=>g((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(i()),t),e.useEffect=_,e.useLayoutEffect=v,e.useMemo=g,e.useReducer=(e,t,n)=>b(k,S,M,$(e,t,n)),e.useRef=e=>{const t=i(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>b(k,S,M,(e=>$(E,e))(e)),e.wait=d,e}({}); |
26
index.js
@@ -42,3 +42,11 @@ self.uhooksFX = (function (exports) { | ||
schedule = new Set(); | ||
previous.forEach(update); | ||
previous.forEach(function (_ref) { | ||
var h = _ref.h, | ||
c = _ref.c, | ||
a = _ref.a, | ||
e = _ref.e; | ||
// avoid running schedules when the hook is | ||
// re-executed before such schedule happens | ||
if (e) h.apply(c, a); | ||
}); | ||
}; | ||
@@ -104,11 +112,2 @@ | ||
}; | ||
var update = function update(_ref) { | ||
var h = _ref.h, | ||
c = _ref.c, | ||
a = _ref.a, | ||
e = _ref.e; | ||
// avoid running schedules when the hook is | ||
// re-executed before such schedule happens | ||
if (e) h.apply(c, a); | ||
}; | ||
var wait = new Lie(function ($) { | ||
@@ -142,3 +141,8 @@ return $(); | ||
_.forEach(update); | ||
_.forEach(function (_ref2) { | ||
var h = _ref2.h, | ||
c = _ref2.c, | ||
a = _ref2.a; | ||
h.apply(c, a); | ||
}); | ||
} | ||
@@ -145,0 +149,0 @@ } |
@@ -1,1 +0,1 @@ | ||
self.uhooksFX=function(n){"use strict";var t="function"==typeof Promise?Promise:function(n){var t,e=[],u=0;return n((function(n){t=n,u=1,e.splice(0).forEach(r)})),{then:r};function r(n){return u?setTimeout(n,0,t):e.push(n),this}},e=null,u=new Set,r=new WeakMap,i=function(n){var t=n.$,e=n.r,u=n.h;h(e)&&(c.get(u).delete(n),e()),h(n.r=t())&&c.get(u).add(n)},o=function(){var n=u;u=new Set,n.forEach(v)},c=new WeakMap,f=[],a=[];function s(n,t){return n!==this[t]}var l=function(){return r.get(e)},h=function(n){return"function"==typeof n},v=function(n){var t=n.h,e=n.c,u=n.a;n.e&&t.apply(e,u)},p=new t((function(n){return n()}));function d(n){var t=this._;this.value!==n&&(this._=new Set,this.value=n,t.forEach(v))}var y=function(n,t){var e=l(),u=e.i,r=e.s;return u!==r.length&&t&&!t.some(s,r[u]._)||(r[u]={$:n(),_:t}),r[e.i++].$},g=function(n){return function(t,e){var u=l(),r=u.i,i=u.s,o=u.h,f=r===i.length;f&&(c.has(o)||c.set(o,new Set),i.push({$:t,_:e,r:null,h:o}));var a=i[u.i++];(f||!e||e.some(s,a._))&&n.push(a)}},w=g(f),E=g(a),$=function(n,t){return h(t)?t(n):t},_=function(n,t,e){var r=l(),i=r.i,c=r.s;i===c.length&&c.push({$:h(e)?e(t):$(void 0,t),set:function(t){c[i].$=n(c[i].$,t),function(n){u.has(n)||(n.e=1,u.add(n),p.then(o))}(r)}});var f=c[r.i++];return[f.$,f.set]},k=null,m=null,S=null,M=new WeakMap,C=function(n,t,e,u){return n?[u[0],function(r){M.has(n)||(M.set(n,0),p.then((function(){M.delete(n),n.apply(t,e)}))),u[1](r)}]:u};return n.createContext=function(n){return{_:new Set,provide:d,value:n}},n.dropEffect=function(n){var t=c.get(n);t&&p.then((function(){t.forEach((function(n){n.r(),n.r=null})),t.clear()}))},n.hasEffect=function(n){return c.has(n)},n.hooked=function(n,t){return function(n){var t={h:u,c:null,a:null,e:0,i:0,s:[]};return r.set(u,t),u;function u(){var r=e;e=u,t.e=t.i=0;try{return n.apply(t.c=this,t.a=arguments)}finally{e=r,f.length&&p.then(f.forEach.bind(f.splice(0),i)),a.length&&a.splice(0).forEach(i)}}}(t?function t(){var e=k,u=m,r=S;k=t,m=this,S=arguments;try{return n.apply(m,S)}finally{k=e,m=u,S=r}}:n)},n.useCallback=function(n,t){return y((function(){return n}),t)},n.useContext=function(n){var t=n._,e=n.value;return t.add(l()),e},n.useEffect=w,n.useLayoutEffect=E,n.useMemo=y,n.useReducer=function(n,t,e){return C(k,m,S,_(n,t,e))},n.useRef=function(n){var t=l(),e=t.i,u=t.s;return e===u.length&&u.push({current:n}),u[t.i++]},n.useState=function(n){return C(k,m,S,function(n){return _($,n)}(n))},n.wait=p,n}({}); | ||
self.uhooksFX=function(n){"use strict";var t="function"==typeof Promise?Promise:function(n){var t,e=[],u=0;return n((function(n){t=n,u=1,e.splice(0).forEach(r)})),{then:r};function r(n){return u?setTimeout(n,0,t):e.push(n),this}},e=null,u=new Set,r=new WeakMap,i=function(n){var t=n.$,e=n.r,u=n.h;h(e)&&(c.get(u).delete(n),e()),h(n.r=t())&&c.get(u).add(n)},o=function(){var n=u;u=new Set,n.forEach((function(n){var t=n.h,e=n.c,u=n.a;n.e&&t.apply(e,u)}))},c=new WeakMap,a=[],f=[];function s(n,t){return n!==this[t]}var l=function(){return r.get(e)},h=function(n){return"function"==typeof n},v=new t((function(n){return n()}));function p(n){var t=this._;this.value!==n&&(this._=new Set,this.value=n,t.forEach((function(n){var t=n.h,e=n.c,u=n.a;t.apply(e,u)})))}var d=function(n,t){var e=l(),u=e.i,r=e.s;return u!==r.length&&t&&!t.some(s,r[u]._)||(r[u]={$:n(),_:t}),r[e.i++].$},y=function(n){return function(t,e){var u=l(),r=u.i,i=u.s,o=u.h,a=r===i.length;a&&(c.has(o)||c.set(o,new Set),i.push({$:t,_:e,r:null,h:o}));var f=i[u.i++];(a||!e||e.some(s,f._))&&n.push(f)}},g=y(a),w=y(f),E=function(n,t){return h(t)?t(n):t},$=function(n,t,e){var r=l(),i=r.i,c=r.s;i===c.length&&c.push({$:h(e)?e(t):E(void 0,t),set:function(t){c[i].$=n(c[i].$,t),function(n){u.has(n)||(n.e=1,u.add(n),v.then(o))}(r)}});var a=c[r.i++];return[a.$,a.set]},_=null,k=null,m=null,S=new WeakMap,M=function(n,t,e,u){return n?[u[0],function(r){S.has(n)||(S.set(n,0),v.then((function(){S.delete(n),n.apply(t,e)}))),u[1](r)}]:u};return n.createContext=function(n){return{_:new Set,provide:p,value:n}},n.dropEffect=function(n){var t=c.get(n);t&&v.then((function(){t.forEach((function(n){n.r(),n.r=null})),t.clear()}))},n.hasEffect=function(n){return c.has(n)},n.hooked=function(n,t){return function(n){var t={h:u,c:null,a:null,e:0,i:0,s:[]};return r.set(u,t),u;function u(){var r=e;e=u,t.e=t.i=0;try{return n.apply(t.c=this,t.a=arguments)}finally{e=r,a.length&&v.then(a.forEach.bind(a.splice(0),i)),f.length&&f.splice(0).forEach(i)}}}(t?function t(){var e=_,u=k,r=m;_=t,k=this,m=arguments;try{return n.apply(k,m)}finally{_=e,k=u,m=r}}:n)},n.useCallback=function(n,t){return d((function(){return n}),t)},n.useContext=function(n){var t=n._,e=n.value;return t.add(l()),e},n.useEffect=g,n.useLayoutEffect=w,n.useMemo=d,n.useReducer=function(n,t,e){return M(_,k,m,$(n,t,e))},n.useRef=function(n){var t=l(),e=t.i,u=t.s;return e===u.length&&u.push({current:n}),u[t.i++]},n.useState=function(n){return M(_,k,m,function(n){return $(E,n)}(n))},n.wait=v,n}({}); |
{ | ||
"name": "uhooks-fx", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "uhooks with propagated states", | ||
@@ -47,3 +47,3 @@ "main": "./cjs/index.js", | ||
"dependencies": { | ||
"uhooks": "^0.1.17" | ||
"uhooks": "^0.1.18" | ||
}, | ||
@@ -50,0 +50,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17741
369
Updateduhooks@^0.1.18