Vinyl
    Preparing search index...

    Function createAbortSlot

    • Creates a reusable abort slot that exposes a read-only Abort instance.

      Each call to abort() triggers the current Abort instance, and then replaces it with a fresh instance for future use. This is useful in systems where cancelable operations are repeatedly started and each one needs its own Abort signal.

      Returns AbortSlot

      An object with:

      • value: A read-only reference to the current Abort instance.
      • abort(reason): Aborts the current instance with the given reason, then creates a new one.

      Example:

      const slot = createAbortSlot()
      fetch(url, { signal: slot.value.signal })
      slot.abort() // aborts current Abort value and prepares a new instance