-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v4 rewrite: hybrid module, TS, and named exports
- Loading branch information
Showing
48 changed files
with
4,216 additions
and
10,534 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Use Nodejs ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Generate typedocs | ||
run: npm run typedoc | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: './docs' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,27 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
## 4.0 | ||
|
||
### [3.0.3](https://github.com/tapjs/signal-exit/compare/v3.0.2...v3.0.3) (2020-03-26) | ||
- Rewritten in TypeScript | ||
- Default export replaced with named exports | ||
- More securely hardened against multiple load and global process | ||
object mutation | ||
- Removed `SIGUNUSED` from the list of Linux signals, as it no | ||
longer exists. | ||
- `SIGABRT`, `SIGALRM` removed from list of Windows signals, as | ||
the are not supported. | ||
|
||
## 3.0.3 (2020-03-26) | ||
|
||
### Bug Fixes | ||
- patch SIGHUP to SIGINT when on Windows (cfd1046) | ||
- ci: use Travis for Windows builds (007add7) | ||
|
||
* patch `SIGHUP` to `SIGINT` when on Windows ([cfd1046](https://github.com/tapjs/signal-exit/commit/cfd1046079af4f0e44f93c69c237a09de8c23ef2)) | ||
* **ci:** use Travis for Windows builds ([007add7](https://github.com/tapjs/signal-exit/commit/007add793d2b5ae3c382512103adbf321768a0b8)) | ||
## 3.0.1 (2016-09-08) | ||
|
||
<a name="3.0.1"></a> | ||
## [3.0.1](https://github.com/tapjs/signal-exit/compare/v3.0.0...v3.0.1) (2016-09-08) | ||
- do not listen on SIGBUS, SIGFPE, SIGSEGV and SIGILL (#40) (5b105fb) | ||
|
||
## 3.0.0 (2016-06-13) | ||
|
||
### Bug Fixes | ||
|
||
* do not listen on SIGBUS, SIGFPE, SIGSEGV and SIGILL ([#40](https://github.com/tapjs/signal-exit/issues/40)) ([5b105fb](https://github.com/tapjs/signal-exit/commit/5b105fb)) | ||
|
||
|
||
|
||
<a name="3.0.0"></a> | ||
# [3.0.0](https://github.com/tapjs/signal-exit/compare/v2.1.2...v3.0.0) (2016-06-13) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* get our test suite running on Windows ([#23](https://github.com/tapjs/signal-exit/issues/23)) ([6f3eda8](https://github.com/tapjs/signal-exit/commit/6f3eda8)) | ||
* hooking SIGPROF was interfering with profilers see [#21](https://github.com/tapjs/signal-exit/issues/21) ([#24](https://github.com/tapjs/signal-exit/issues/24)) ([1248a4c](https://github.com/tapjs/signal-exit/commit/1248a4c)) | ||
|
||
|
||
### BREAKING CHANGES | ||
|
||
* signal-exit no longer wires into SIGPROF | ||
- get our test suite running on Windows (#23) (6f3eda8) | ||
- hooking SIGPROF was interfering with profilers see #21 (#24) (1248a4c) | ||
- signal-exit no longer wires into SIGPROF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,51 @@ | ||
# signal-exit | ||
|
||
[![Build Status](https://travis-ci.org/tapjs/signal-exit.png)](https://travis-ci.org/tapjs/signal-exit) | ||
[![Coverage](https://coveralls.io/repos/tapjs/signal-exit/badge.svg?branch=master)](https://coveralls.io/r/tapjs/signal-exit?branch=master) | ||
[![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit) | ||
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) | ||
|
||
When you want to fire an event no matter how a process exits: | ||
|
||
* reaching the end of execution. | ||
* explicitly having `process.exit(code)` called. | ||
* having `process.kill(pid, sig)` called. | ||
* receiving a fatal signal from outside the process | ||
- reaching the end of execution. | ||
- explicitly having `process.exit(code)` called. | ||
- having `process.kill(pid, sig)` called. | ||
- receiving a fatal signal from outside the process | ||
|
||
Use `signal-exit`. | ||
|
||
```js | ||
var onExit = require('signal-exit') | ||
// Hybrid module, either works | ||
import { onExit } from 'signal-exit' | ||
// or: | ||
// const { onExit } = require('signal-exit') | ||
|
||
onExit(function (code, signal) { | ||
console.log('process exited!') | ||
onExit((code, signal) => { | ||
console.log('process exited!', code, signal) | ||
}) | ||
``` | ||
|
||
## API | ||
|
||
`var remove = onExit(function (code, signal) {}, options)` | ||
`remove = onExit((code, signal) => {}, options)` | ||
|
||
The return value of the function is a function that will remove | ||
the handler. | ||
|
||
Note that the function _only_ fires for signals if the signal | ||
would cause the process to exit. That is, there are no other | ||
listeners, and it is a fatal signal. | ||
|
||
If the global `process` object is not suitable for this purpose | ||
(ie, it's unset, or doesn't have an `emit` method, etc.) then the | ||
`onExit` function is a no-op that returns a no-op `remove` method. | ||
|
||
### Options | ||
|
||
The return value of the function is a function that will remove the | ||
handler. | ||
- `alwaysLast`: Run this handler after any other signal or exit | ||
handlers. This causes `process.emit` to be monkeypatched. | ||
|
||
Note that the function *only* fires for signals if the signal would | ||
cause the process to exit. That is, there are no other listeners, and | ||
it is a fatal signal. | ||
### Browser Fallback | ||
|
||
## Options | ||
The `'signal-exit/browser'` module is the same fallback shim that | ||
just doesn't do anything, but presents the same function | ||
interface. | ||
|
||
* `alwaysLast`: Run this handler after any other signal or exit | ||
handlers. This causes `process.emit` to be monkeypatched. | ||
Patches welcome to add something that hooks onto | ||
`window.onbeforeunload` or similar, but it might just not be a | ||
thing that makes sense there. |
Oops, something went wrong.