# awesome-channels

> Messaging channels over window.postMessage

Latest version **0.0.1** (published 2017-09-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install awesome-channels
pnpm add awesome-channels
yarn add awesome-channels
bun add awesome-channels
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2017-09-20 |
| First published | 2017-09-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | kobelb |

## Links

- npm: https://www.npmjs.com/package/awesome-channels
- npm.io page: https://npm.io/package/awesome-channels

## Dependencies (1)

- [uuid](https://npm.io/package/uuid.md) ^2.0.1

## Recent versions

- 0.0.1 (latest) — 2017-09-20

## README

# Installation

```
npm install awesome-channels
```

import/require the library

```javascript
import { Channel } from 'awesome-channels';
```

# Usage
Channels work within a namespace. All publishers/consumers that wish to communicate should be using the same namespace. 

The recommended namespacing is 'project-name:page-name:sub-page-name' ommitting the sub-page-name if not appropriate. For example 'web-application:users:sign-up'.

```javascript
var channel = new Channel('web-application:users:sign-up');
```


To notify consumers that an event occurred we use the 'emit' method on the instance of the channel

```javascript
channel.emit('done', {studentId: 1});
```


to be alerted that an event occurred we use subscribe to the event using the 'on' method


```javascript
channel.on('done', function (payload) {
   console.log(payload);
   // in this example the console would print '{studentId: 1}'
});
```

---
_Source: https://npm.io/package/awesome-channels · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
