PageSourceSearch

https://cdn.gogocasino.com/frontend/senna/_next/static/chunks/page…yncActionPollingExample-17ed3fd92b67449a.js

js gogocasino.com collected 2026-09-26 03:53:28 UTC 4,404 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[67278],{12867:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>v});var s=r(80263),n=r(53239),i=r(60907),c=r(46563),l=r(59689),a=r(36375),u=r(60539),o=r(95707),d=r(46608),x=r(65969),h=r(92027),A=r(24644),j=r(10234),m=r(82909),f=r(59245);let p=e=>{let{counter:t,state:r,retryCountDown:n,props:u}=e;return(0,s.jsxs)("div",{children:[(0,s.jsxs)(i.A,{p:2,sx:{height:100},children:[r.pending&&(0,s.jsxs)(i.A,{p:1,children:[(0,s.jsx)(c.A,{variant:"body2",gutterBottom:!0,children:1===t?"Loading...":"Retrying (".concat(t,")...")}),(0,s.jsx)(i.A,{sx:{width:"100%"},children:(0,s.jsx)(l.A,{})})]}),r.rejected&&(0,s.jsxs)(a.A,{severity:"error",children:["Failure (",t,")",n?", retry in: ".concat(n):""]}),r.fulfilled&&(0,s.jsx)(a.A,{severity:"success",children:"Much greatness, success and happy times"})]}),(0,s.jsxs)("pre",{children:["state: ",JSON.stringify(r,null,2)]}),(0,s.jsxs)("pre",{children:["props: ",JSON.stringify(u,null,2)]})]})},y=e=>{let{maxTries:t,interval:r,shouldFail:i}=e,l=(0,n.useRef)(0),[a,u]=(0,m.A)(t,r,()=>(l.current+=1,new Promise((e,r)=>setTimeout(()=>{l.current>=t&&!i?e():r("Unable to perform most important and great action!")},500))));return(0,n.useEffect)(()=>{a()},[a]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{variant:"h6",children:"usePollAsyncAction hook Polling Example"}),(0,s.jsx)(p,{state:u,counter:l.current,props:{maxTries:t,interval:r,shouldFail:i}})]})},g=e=>{let{maxTries:t,interval:r,shouldFail:i}=e,l=(0,n.useRef)(0),[a,u,o]=(0,j.Ay)(()=>(l.current+=1,new Promise((e,r)=>setTimeout(()=>{l.current>=t&&!i?e():r("Unable to perform most important and great action!")},500)))),[d,x]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,[r,s]=(0,n.useState)(e),[i,c]=(0,n.useState)("IDLE"),l=(0,n.useCallback)(t=>{switch(t){case"start":c("COUNTING");break;case"stop":c("IDLE");break;case"reset":c("IDLE"),s(e)}},[e]);return(0,n.useEffect)(()=>{if("COUNTING"===i){if(r>0){let e=setTimeout(()=>s(e=>Math.max(0,e-1)),t);return()=>clearTimeout(e)}l("stop")}},[i,l,r,e,t]),[l,r]}(3,r/3);return(0,n.useEffect)(()=>{let e=l.current<t;u.rejected&&e&&(d("start"),0===x&&(o(),d("reset"))),(0,j.AB)(u)&&e&&a()},[u,a,o,d,x,t]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{variant:"h6",children:"AsyncActionPollingExample"}),(0,s.jsx)(p,{state:u,counter:l.current,retryCountDown:l.current<t?x:void 0,props:{maxTries:t,interval:r,shouldFail:i}})]})},E=()=>{let[e,t]=(0,n.useState)(!1),[r,l]=(0,n.useState)(!1);return(0,s.jsxs)(u.A,{maxWidth:"lg",children:[(0,s.jsx)(c.A,{variant:"h3",gutterBottom:!0,children:"Manual AsyncAction Polling Example"}),(0,s.jsx)(o.A,{}),(0,s.jsxs)(d.Ay,{container:!0,spacing:2,sx:{justifyContent:"flex-start",alignItems:"center"},children:[(0,s.jsx)(d.Ay,{item:!0,children:(0,s.jsx)(x.A,{onClick:()=>t(e=>!e),children:e?"Reset":"Start"})}),!e&&(0,s.jsx)(d.Ay,{item:!0,children:(0,s.jsx)(h.A,{control:(0,s.jsx)(A.A,{checked:r,onClick:()=>l(e=>!e)}),label:"Should Fail"})})]}),(0,s.jsx)(o.A,{}),e&&(0,s.jsx)(i.A,{pt:2,children:(0,s.jsxs)(d.Ay,{container:!0,spacing:2,children:[(0,s.jsx)(d.Ay,{item:!0,xs:12,sm:6,children:(0,s.jsx)(g,{maxTries:5,interval:1e3,shouldFail:r})}),(0,s.jsx)(d.Ay,{item:!0,xs:12,sm:6,children:(0,s.jsx)(y,{maxTries:5,interval:1e3,shouldFail:r})})]})})]})};E.PageLayout=f.Ay;let v=E},37501:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_debug/elements/AsyncActionPollingExample",function(){return r(12867)}])},82909:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var s=r(53239),n=r(10234),i=r(90568);
1function c(e,t,r){let c=(0,s.useRef)(),[l,a]=(0,s.useState)(0),u=(0,i.A)(r),[o,d,x]=(0,n.Ay)(async function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return a(e=>e+1),c.current=t,u(...t)}),[h,A]=(0,s.useState)(d),j=(0,s.useCallback)(()=>"function"==typeof t?t(l):t,[t,l]),m=(0,s.useCallback)(()=>{x(),a(0),A(n.z7)},[x]),f=(0,s.useCallback)(()=>{c.current&&(x(),o(...c.current))},[o,x]);return(0,s.useEffect)(()=>{if(d.rejected){if(l<e){let e=setTimeout(f,j());return()=>clearTimeout(e)}return void A({...d,error:[...d.error,"ERROR_POLLING_COMPLETED","Polling completed after ".concat(l," tries.")]})}A(d)},[d,l,e,f,j]),[o,h,m,d]}}},e=>{e.O(0,[24149,4600,43634,24644,46608,45495,59245,3643,90636,46593,38792],()=>e(e.s=37501)),_N_E=e.O()}]);
2//# sourceMappingURL=AsyncActionPollingExample-17ed3fd92b67449a.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.