https://github.com/sammwyy/ehdeno
An easy to use Event Handler for Deno
https://github.com/sammwyy/ehdeno
deno typescript
Last synced: 2 months ago
JSON representation
An easy to use Event Handler for Deno
- Host: GitHub
- URL: https://github.com/sammwyy/ehdeno
- Owner: sammwyy
- Created: 2020-02-11T18:40:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-10T17:32:07.000Z (over 6 years ago)
- Last Synced: 2025-12-19T14:39:26.194Z (6 months ago)
- Topics: deno, typescript
- Language: TypeScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ehDeno
A small and easy to use Event Handler for Deno.
## How to use:
```typescript
// Import the library
import { EventHandler } from 'https://raw.githubusercontent.com/sammwyy/ehDeno/master/ehdeno.ts';
// Instantiate EventHandler
const events = new EventHandler();
```
## Functions:
### on
**Description:** Use this function to register an event and add a callback function that will be executed when calling that event.
**Returns:** Void
**Example**
```typescript
events.on("saysHelloWorld", () => {
console.log("Hello World");
})
```
### emit
**Description:** Use this function to execute all callbacks of an event.
**Returns:** Void
**Example**
```typescript
events.emit("saysHelloWorld");
```
### clear
**Description:** Use this function to clear the callbacks list of an event.
**Returns:** Void
**Example**
```typescript
events.clear("saysHelloWorld");
```
### clearAll
**Description:** Use this function to clear the callbacks list of all events.
**Returns:** Void
**Example**
```typescript
events.clearAll();
```
### get
**Description:** This function returns a list with the callbacks of an event.
**Example**
**Returns:** List
```typescript
events.get("saysHelloWorld");
```
### list
**Description:** This function returns a list of all handled events.
**Returns:** List
**Example**
```typescript
events.clearAll();
```
### count
**Description:** This function returns the count of handled events.
**Returns:** Number
**Example**
```typescript
events.clearAll();
```
### hasHandled
**Description:** This function returns `true` if the event is handled, otherwise returns `false`.
**Returns:** List
**Example:**
```typescript
events.hasHandled("saysHelloWorld");
```
###### Made with ❤️