Skip to content

Commit 28d3767

Browse files
committed
fix: docs
1 parent 79e4ddb commit 28d3767

File tree

2 files changed

+45
-13
lines changed

2 files changed

+45
-13
lines changed

README.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1-
# Template
1+
# Custom Event Target
22

3-
[![Run Linter](https://github.com/DenoPlayground/Template/actions/workflows/lint.yml/badge.svg)](https://github.com/DenoPlayground/Template/actions/workflows/lint.yml)
4-
[![Run Unit Tests](https://github.com/DenoPlayground/Template/actions/workflows/test.yml/badge.svg)](https://github.com/DenoPlayground/Template/actions/workflows/test.yml)
3+
[![Run Linter](https://github.com/TypeScriptPlayground/custom-event-target/actions/workflows/lint.yml/badge.svg)](https://github.com/TypeScriptPlayground/custom-event-target/actions/workflows/lint.yml)
4+
[![Run Unit Tests](https://github.com/TypeScriptPlayground/custom-event-target/actions/workflows/unit_tests.yml/badge.svg)](https://github.com/TypeScriptPlayground/custom-event-target/actions/workflows/unit_tests.yml)
55

6-
This is a template for a Deno module.
6+
This package contains a class and types for a `CustomEventTarget`.
77

8-
## File/Directory Structure
8+
## Example
99

10-
- `cli.ts` - File for functions which should be executed directly for the module.
11-
- `src/` - Directory for storing all source code.
12-
- `docs/` - Directory for storing all documentation files specific for the module.
10+
```ts
11+
import { CustomEventTarget, type CustomEventListenerOrCustomEventListenerObject } from '@typescriptplayground/custom-event-target'
12+
13+
class MyClass<MyEvents extends 'foo' | 'bar' | 'baz'> extends CustomEventTarget {
14+
override addEventListener(
15+
type : MyEvents,
16+
listener : CustomEventListenerOrCustomEventListenerObject<MyEvents> | null,
17+
options? : boolean | AddEventListenerOptions
18+
) : void {
19+
20+
}
21+
22+
override removeEventListener(
23+
type : MyEvents,
24+
listener : CustomEventListenerOrCustomEventListenerObject<MyEvents> | null,
25+
options? : boolean | EventListenerOptions
26+
) : void {
27+
28+
}
29+
}
30+
```

src/index.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,25 @@
33
*
44
* @example
55
* ```ts
6-
* class MyClass extends CustomEventTarget { ... }
7-
* ```
8-
* @example
9-
* ```ts
10-
* const target = new CustomEventTarget();
6+
* import { CustomEventTarget, type CustomEventListenerOrCustomEventListenerObject } from '@typescriptplayground/custom-event-target'
7+
*
8+
* class MyClass<MyEvents extends 'foo' | 'bar' | 'baz'> extends CustomEventTarget {
9+
* override addEventListener(
10+
* type : MyEvents,
11+
* listener : CustomEventListenerOrCustomEventListenerObject<MyEvents> | null,
12+
* options? : boolean | AddEventListenerOptions
13+
* ) : void {
14+
*
15+
* }
16+
*
17+
* override removeEventListener(
18+
* type : MyEvents,
19+
* listener : CustomEventListenerOrCustomEventListenerObject<MyEvents> | null,
20+
* options? : boolean | EventListenerOptions
21+
* ) : void {
22+
*
23+
* }
24+
* }
1125
* ```
1226
* @module
1327
*/

0 commit comments

Comments
 (0)