Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
javierlopezdeancos committed Sep 16, 2021
1 parent 0b8ef6c commit 45717c1
Show file tree
Hide file tree
Showing 10 changed files with 4,855 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

### Npm
node_modules
59 changes: 57 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,57 @@
# laguagua
Another typescript bus event
![logo](assets/img/logo.jpg)

# La GuaGua

Another typescript bus event.


## Why?

Why not.

## Install

```
npm i laguagua --save
```

## Usage

### Import

```typescript
import { laGuaGua } from 'laguagua';
```

### Interface
Review and use to your implementations how the Laguagua interface looks

```typescript
export interface ILaGuaGua {
publish: (message: string, data?: Object) => void;
subscribe: (message: string, trigger: Handler) => void;
clear: () => void;
}
```

### Publish
publish an event message.

```typescript
bus.publish('bus::stop');
```

### Subscribe
Subscribe into an event message.

```typescript
const eventHandler = (message, data) => console.log(message);
bus.subscribe('bus::stop', eventHandler);
```

### Clear
Clear all bus subscriptions.

```typescript
bus.clear();
```
Binary file added assets/img/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export declare type Handler = (message: string, data?: Object) => void;
declare type Subscriptions = {
[key: string]: Handler[];
};
export interface ILaGuaGua {
publish: (message: string, data?: Object) => void;
subscribe: (message: string, trigger: Handler) => void;
clear: () => void;
}
declare class LaGuaGua implements ILaGuaGua {
subscriptions: Subscriptions;
constructor();
publish(message: string, data?: Object): void;
subscribe(message: string, trigger: Handler): void;
clear(): void;
}
export default LaGuaGua;
export declare const laGuaGua: LaGuaGua;
42 changes: 42 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 45717c1

Please sign in to comment.