Skip to content

Commit 257fe89

Browse files
cerebralkungfuPhillip Clark
cerebralkungfu
and
Phillip Clark
authored
TS reboot (#13)
* reworked ts, building esm, cjs, and browser * refinement and docs * github worflow for CI Co-authored-by: Phillip Clark <[email protected]>
1 parent 3ae2d50 commit 257fe89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+12906
-28481
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
node_modules/
3+
coverage/

.eslintrc.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
{
2+
"root": true,
23
"env": {
34
"browser": false,
4-
"es6": true,
5-
"node": true
5+
"es2020": true,
6+
"node": true,
7+
"jest": true
68
},
79
"parser": "@typescript-eslint/parser",
810
"parserOptions": {
911
"project": "./tsconfig.json",
1012
"sourceType": "module"
1113
},
12-
"plugins": [
13-
"@typescript-eslint"
14-
],
14+
"plugins": ["@typescript-eslint", "jest"],
1515
"extends": [
1616
"eslint:recommended",
1717
"plugin:@typescript-eslint/eslint-recommended",
1818
"plugin:@typescript-eslint/recommended",
19-
"prettier",
20-
"prettier/@typescript-eslint"
19+
"plugin:prettier/recommended"
2120
],
2221
"rules": {}
2322
}

.github/workflows/ci.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
pull_request:
8+
branches:
9+
- main
10+
11+
# Allows triggering workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
build_and_test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: checkout code
20+
uses: actions/checkout@v2
21+
22+
- name: use node.js
23+
uses: actions/setup-node@v2
24+
with:
25+
node-version: '16.x'
26+
registry-url: 'https://registry.npmjs.org'
27+
28+
- name: install dependencies
29+
run: npm ci
30+
31+
- name: build and test
32+
run: npm run ci

.mocharc.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

.npmignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# cleanup-util &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/flitbit/cleanup-util/blob/master/LICENSE)
2+
23
> Utility for cleaning up event handlers
34
4-
**cleanup-util** is a small, utility for tracking and cleaning up event handlers. I find this utility useful when I have classes derived from EventHandler that are used throughout the life of my applications and those EventHandlers frequently have event handlers added and removed. It helps me catch memory leaks from dangling event listeners early in the development process. I hope you find it useful.
5+
**cleanup-util** is a small, utility for tracking and cleaning up event handlers. I find this utility useful when I have classes derived from EventHandler that are used throughout the life of my applications and those EventHandlers frequently have event handlers added and removed. It helps me catch memory leaks from dangling event listeners early in the development process. I hope you find it useful.
56

67
## Installing / Getting started
78

@@ -23,8 +24,8 @@ function cleanupPropagationEvent<T extends EventEmitter>(
2324
event: string,
2425
listener: Listener,
2526
target: EventEmitter,
26-
reciprocal?: string
27-
): void
27+
reciprocal?: string,
28+
): void;
2829
```
2930

3031
Attaches the specified `listener` to the specified `sender`, wrapping the `listener` to track it's cleanup.
@@ -34,7 +35,11 @@ If `reciprocal` is specified, it is the name of an event on `target`, **cleanup-
3435
### addCleanupTask
3536

3637
```ts
37-
function addCleanupTask<S extends EventEmitter, T>(sender: S, target: T, task: Task): void
38+
function addCleanupTask<S extends EventEmitter, T>(
39+
sender: S,
40+
target: T,
41+
task: Task,
42+
): void;
3843
```
3944

4045
Adds a task to be run when the cleanup propagation event occurs.
@@ -53,7 +58,7 @@ Clears the instance Id associated with an object.
5358

5459
## Tests
5560

56-
Tests are built using [Mocha](https://mochajs.org/) and chai.
61+
Tests are built using [Jest](https://jestjs.io/); we're near 100%!
5762

5863
```shell
5964
npm test

__tests__/.eslintrc.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

docs/.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

docs/_config.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)