{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/try-on-mounted/index.ts"],"sourcesContent":["import type { Fn } from '../types';\nimport { getCurrentInstance, nextTick, onMounted } from 'vue';\n\n/**\n * Call onMounted() if it's inside a component lifecycle, if not, just call the function\n *\n * @param fn\n * @param sync if set to false, it will run in the nextTick() of Vue\n */\nexport function tryOnMounted(fn: Fn, sync = true) {\n  if (getCurrentInstance()) onMounted(fn);\n  else if (sync) fn();\n  else nextTick(fn);\n}\n"],"names":[],"mappings":";;AASgB,SAAA,YAAA,CAAa,EAAQ,EAAA,IAAA,GAAO,IAAM,EAAA;AAChD,EAAA,IAAI,kBAAmB,EAAA;AAAG,IAAA,SAAA,CAAU,EAAE,CAAA,CAAA;AAAA,OAC7B,IAAA,IAAA;AAAM,IAAG,EAAA,EAAA,CAAA;AAAA;AACb,IAAA,QAAA,CAAS,EAAE,CAAA,CAAA;AAClB;;;;"}