开发者社区> 镜像站> NPM> abort-controller
abort-controller
An implementation of WHATWG AbortController interface.
Last updated 2 years ago by mysticatea .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install abort-controller 
SYNC missed versions from official npm registry.

abort-controller

npm version Downloads/month Build Status Coverage Status Dependency Status

An implementation of WHATWG AbortController interface.

import AbortController from "abort-controller"

const controller = new AbortController()
const signal = controller.signal

signal.addEventListener("abort", () => {
    console.log("aborted!")
})

controller.abort()

https://jsfiddle.net/1r2994qp/1/

???? Installation

Use npm to install then use a bundler.

npm install abort-controller

Or download from dist directory.

???? Usage

import AbortController from "abort-controller"
// or
const AbortController = require("abort-controller")

// or UMD version defines a global variable:
const AbortController = window.AbortControllerShim

AbortController

https://dom.spec.whatwg.org/#interface-abortcontroller

controller.signal

The AbortSignal object which is associated to this controller.

controller.abort()

Notify abort event to listeners that the signal has.

???? Changelog

???? Contributing

Contributing is welcome ❤️

Please use GitHub issues/PRs.

Development tools

  • npm install installs dependencies for development.
  • npm test runs tests and measures code coverage.
  • npm run clean removes temporary files of tests.
  • npm run coverage opens code coverage of the previous test with your default browser.
  • npm run lint runs ESLint.
  • npm run build generates dist codes.
  • npm run watch runs tests on each file change.

Current Tags

  • 3.0.0                                ...           latest (2 years ago)
  • 3.0.0                                ...           next (2 years ago)

11 Versions

  • 3.0.0                                ...           2 years ago
  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.1.0-beta.0                                ...           2 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 34
This Week 6,994
This Month 5,756
Last Day 473
Last Week 7,454
Last Month 31,550
Dependencies (1)
Dependents (448)