/*! For license information please see 87e62e93.f55d6bfd.js.LICENSE.txt */
"use strict";(self.webpackChunkweb_totals=self.webpackChunkweb_totals||[]).push([[458],{80442:(t,e,s)=>{s.r(e),s.d(e,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>n,metadata:()=>r,toc:()=>l});var o=s(85893),i=s(11151);const n={sidebar_position:1,title:"Delay without setTimeout",comment:!0,tags:["Javascript","Utils"]},a=void 0,r={id:"javascripts/delay-without-set-timeout",title:"Delay without setTimeout",description:"This is a delay function without setTimeout and promise in javascript",source:"@site/issues/javascripts/delay-without-set-timeout.md",sourceDirName:"javascripts",slug:"/javascripts/delay-without-set-timeout",permalink:"/issues/javascripts/delay-without-set-timeout",draft:!1,unlisted:!1,editUrl:"https://github.com/hunghg255/web-totals/tree/main/issues/javascripts/delay-without-set-timeout.md",tags:[{label:"Javascript",permalink:"/issues/tags/javascript"},{label:"Utils",permalink:"/issues/tags/utils"}],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"Delay without setTimeout",comment:!0,tags:["Javascript","Utils"]},sidebar:"tutorialSidebar",previous:{title:"Issues",permalink:"/issues/"},next:{title:"Random",permalink:"/issues/javascripts/1loc/random"}},c={},l=[];function u(t){const e={code:"code",p:"p",pre:"pre",...(0,i.a)(),...t.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.p,{children:"This is a delay function without setTimeout and promise in javascript"}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-javascript",children:"const delay = (time) => {\n  const now = Date.now();\n\n  while (true) {\n    if (Date.now() > now + time) break;\n  }\n};\n\nconsole.log('foo');\ndelay(1000); // 1s\nconsole.log('bar');\n"})})]})}function p(t={}){const{wrapper:e}={...(0,i.a)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(u,{...t})}):u(t)}},75251:(t,e,s)=>{var o=s(67294),i=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,r=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(t,e,s){var o,n={},l=null,u=null;for(o in void 0!==s&&(l=""+s),void 0!==e.key&&(l=""+e.key),void 0!==e.ref&&(u=e.ref),e)a.call(e,o)&&!c.hasOwnProperty(o)&&(n[o]=e[o]);if(t&&t.defaultProps)for(o in e=t.defaultProps)void 0===n[o]&&(n[o]=e[o]);return{$$typeof:i,type:t,key:l,ref:u,props:n,_owner:r.current}}e.Fragment=n,e.jsx=l,e.jsxs=l},85893:(t,e,s)=>{t.exports=s(75251)},11151:(t,e,s)=>{s.d(e,{Z:()=>r,a:()=>a});var o=s(67294);const i={},n=o.createContext(i);function a(t){const e=o.useContext(n);return o.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function r(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(i):t.components||i:a(t.components),o.createElement(n.Provider,{value:e},t.children)}}}]);