1.0.3 • Published 2 years ago

v-use-unmount-signal v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

v-use-unmount-signal

A port of expo's use-unmount-signal that cancels promises when a component is unmounted. Works with Vue 2 and 3.

AbortSignal API

Install

pnpm add v-use-unmount-signal

Example

<script setup>
import useUnmountSignal from 'v-use-unmount-signal'

const unmountSignal = useUnmountSignal()

const ping = () => {
  fetch('https://ping.example.com', { signal: unmountSignal })
}
</script>

<template>
  <button @click="ping">Ping</button>
</template>

License

MIT

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

3 years ago