ll-package
Version:
2 lines (1 loc) • 692 B
JavaScript
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),r=require("../../../_util/raf.js");function s(l){const u=n.shallowRef(),a=n.shallowRef(!1);function f(){for(var o=arguments.length,e=new Array(o),t=0;t<o;t++)e[t]=arguments[t];a.value||(r.default.cancel(u.value),u.value=r.default(()=>{l(...e)}))}return n.onBeforeUnmount(()=>{a.value=!0,r.default.cancel(u.value)}),f}function c(l){const u=n.shallowRef([]),a=n.shallowRef(typeof l=="function"?l():l),f=s(()=>{let e=a.value;u.value.forEach(t=>{e=t(e)}),u.value=[],a.value=e});function o(e){u.value.push(e),f()}return[a,o]}exports.default=s;exports.useRafState=c;
;