版博士V2.0程序
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

33 行
758 B

  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. const useThrottleRender = (loading, throttle = 0) => {
  5. if (throttle === 0)
  6. return loading;
  7. const throttled = vue.ref(false);
  8. let timeoutHandle = 0;
  9. const dispatchThrottling = () => {
  10. if (timeoutHandle) {
  11. clearTimeout(timeoutHandle);
  12. }
  13. timeoutHandle = window.setTimeout(() => {
  14. throttled.value = loading.value;
  15. }, throttle);
  16. };
  17. vue.onMounted(dispatchThrottling);
  18. vue.watch(() => loading.value, (val) => {
  19. if (val) {
  20. dispatchThrottling();
  21. } else {
  22. throttled.value = val;
  23. }
  24. });
  25. return throttled;
  26. };
  27. exports.useThrottleRender = useThrottleRender;
  28. //# sourceMappingURL=index.js.map