element-plus
Version:
A Component Library for Vue 3
1 lines • 773 B
Source Map (JSON)
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../packages/hooks/use-timeout/index.ts"],"sourcesContent":["import { tryOnScopeDispose } from '@vueuse/core'\n\nexport function useTimeout() {\n let timeoutHandle: number\n\n const registerTimeout = (fn: (...args: any[]) => any, delay: number) => {\n cancelTimeout()\n timeoutHandle = window.setTimeout(fn, delay)\n }\n const cancelTimeout = () => window.clearTimeout(timeoutHandle)\n\n tryOnScopeDispose(() => cancelTimeout())\n\n return {\n registerTimeout,\n cancelTimeout,\n }\n}\n"],"mappings":";;;AAEA,SAAgB,aAAa;CAC3B,IAAI;CAEJ,MAAM,mBAAmB,IAA6B,UAAkB;AACtE,iBAAe;AACf,kBAAgB,OAAO,WAAW,IAAI,MAAM;;CAE9C,MAAM,sBAAsB,OAAO,aAAa,cAAc;AAE9D,yBAAwB,eAAe,CAAC;AAExC,QAAO;EACL;EACA;EACD"}