Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.lib.composables.lazy.mjs.map Maven / Gradle / Ivy
{"version":3,"file":"lazy.mjs","names":["computed","shallowRef","watch","propsFactory","makeLazyProps","eager","Boolean","useLazy","props","active","isBooted","hasContent","value","onAfterLeave"],"sources":["../../src/composables/lazy.ts"],"sourcesContent":["// Utilities\nimport { computed, shallowRef, watch } from 'vue'\nimport { propsFactory } from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\n\nexport const makeLazyProps = propsFactory({\n eager: Boolean,\n}, 'lazy')\n\nexport function useLazy (props: { eager: boolean }, active: Ref) {\n const isBooted = shallowRef(false)\n const hasContent = computed(() => isBooted.value || props.eager || active.value)\n\n watch(active, () => isBooted.value = true)\n\n function onAfterLeave () {\n if (!props.eager) isBooted.value = false\n }\n\n return { isBooted, hasContent, onAfterLeave }\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,EAAEC,UAAU,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACxCC,YAAY,6BAErB;AAGA,OAAO,MAAMC,aAAa,GAAGD,YAAY,CAAC;EACxCE,KAAK,EAAEC;AACT,CAAC,EAAE,MAAM,CAAC;AAEV,OAAO,SAASC,OAAOA,CAAEC,KAAyB,EAAEC,MAAoB,EAAE;EACxE,MAAMC,QAAQ,GAAGT,UAAU,CAAC,KAAK,CAAC;EAClC,MAAMU,UAAU,GAAGX,QAAQ,CAAC,MAAMU,QAAQ,CAACE,KAAK,IAAIJ,KAAK,CAACH,KAAK,IAAII,MAAM,CAACG,KAAK,CAAC;EAEhFV,KAAK,CAACO,MAAM,EAAE,MAAMC,QAAQ,CAACE,KAAK,GAAG,IAAI,CAAC;EAE1C,SAASC,YAAYA,CAAA,EAAI;IACvB,IAAI,CAACL,KAAK,CAACH,KAAK,EAAEK,QAAQ,CAACE,KAAK,GAAG,KAAK;EAC1C;EAEA,OAAO;IAAEF,QAAQ;IAAEC,UAAU;IAAEE;EAAa,CAAC;AAC/C","ignoreList":[]}