Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lifenautjoe/noel
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.0
Choose a base ref
...
head repository: lifenautjoe/noel
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 13 commits
  • 7 files changed
  • 2 contributors

Commits on Nov 9, 2017

  1. Copy the full SHA
    cdf0a54 View commit details
  2. chore(logo): add

    lifenautjoe committed Nov 9, 2017
    Copy the full SHA
    63b9a4b View commit details
  3. docs(README): add logo

    Joel Hernández authored Nov 9, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    93cfd8c View commit details
  4. chore(npm): up patch

    lifenautjoe committed Nov 9, 2017
    Copy the full SHA
    46af9a3 View commit details
  5. Copy the full SHA
    43d8382 View commit details
  6. docs(code-of-conduct): change report mail

    Joel Hernández authored Nov 9, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    49ad9a0 View commit details
  7. docs(README): rephrase humans api

    Joel Hernández authored Nov 9, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fdbea4e View commit details
  8. docs(README): remove TODOs

    Joel Hernández authored Nov 9, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ef5b1fa View commit details
  9. docs(README): add TOC

    lifenautjoe committed Nov 9, 2017
    Copy the full SHA
    5f596b2 View commit details

Commits on Nov 10, 2017

  1. Copy the full SHA
    c8588f1 View commit details
  2. chore(npm): up patch

    lifenautjoe committed Nov 10, 2017
    Copy the full SHA
    9c778b2 View commit details
  3. Copy the full SHA
    9122cb8 View commit details
  4. chore(npm): up patch

    lifenautjoe committed Nov 10, 2017
    Copy the full SHA
    0023bfd View commit details
Showing with 40 additions and 18 deletions.
  1. +32 −11 README.md
  2. +1 −1 code-of-conduct.md
  3. +2 −2 docs/index.html
  4. BIN noel-logo.png
  5. +1 −1 package.json
  6. +2 −1 src/event-listener-manager.ts
  7. +2 −2 website/index.html
43 changes: 32 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
# Noel
<img alt="Noel logo" src="https://github.com/lifenautjoe/noel/blob/master/noel-logo.png?raw=true" width="250">

A universal, human-centric, replayable event emitter.

[![Build Status](https://travis-ci.org/lifenautjoe/noel.svg?branch=master)](https://travis-ci.org/lifenautjoe/noel) ![Human Friendly](https://img.shields.io/badge/human-friendly-brightgreen.svg) [![Coverage Status](https://coveralls.io/repos/github/lifenautjoe/noel/badge.svg?branch=master)](https://coveralls.io/github/lifenautjoe/noel?branch=master)

## \[Work in progress\]
## Table of Contents

- [Motivation](#motivation)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
* [Creating a noel instance](#creating-a-noel-instance)
* [Emitting and listening to events](#emitting-and-listening-to-events)
* [Replaying events](#replaying-events)
* [Disabling replay](#disabling-replay)
* [Enabling replay](#enabling-replay)
* [Removing an event listener](#removing-an-event-listener)
* [Removing all event listeners](#removing-all-event-listeners)
* [Clearing an event replay buffer](#clearing-an-event-replay-buffer)
* [Clearing all events replay buffers](#clearing-all-events-replay-buffers)
* [Changing the events replay buffer size](#changing-the-events-replay-buffer-size)
* [Disabling the no event listeners warning](#disabling-the-no-event-listeners-warning)
* [Enabling the no event listeners warning](#enabling-the-no-event-listeners-warning)
- [Development](#development)
* [Clone the repository](#clone-the-repository)
* [Use npm commands](#use-npm-commands)

## Motivation

@@ -34,7 +54,7 @@ Meaning that if the `userChanged` event was already fired, it will be replayed w
## Features

* Event replaying. Never miss a beat.
* Human API. No useless concepts to try to make sense of.
* API designed for humans. No useless concepts to try to make sense of.

## Installation

@@ -99,6 +119,14 @@ noel.enableReplay(anotherBufferSize);
noel.removeListener(eventName, eventListener);
```

or if you save a reference to the `eventManager`

```typescript
const eventManager = noel.on('myEvent', eventListener);
// ...
eventManager.remove();
```

### Removing all event listeners

```typescript
@@ -157,7 +185,7 @@ noel.disableNoEventListenersWarning();

### Enabling the no event listeners warning

Please do note that the** no event listeners warning is enabled by default**, so this should only be necessary if it was disabled at runtime.
Please do note that the **no event listeners warning is enabled by default**, so this should only be necessary if it was disabled at runtime.

```typescript
noel.enableNoEventListenersWarning();
@@ -181,12 +209,5 @@ git clone git@github.com:lifenautjoe/noel.git
* `npm run lint`: Lints code
* `npm run commit`: Commit using conventional commit style \([husky](https://github.com/typicode/husky) will tell you to use it if you haven't :wink:\)

## TODO

* [x] 100% Relevant lines coverage
* [x] Documentation
* [ ] Website
* [ ] 100% Branch coverage

Author [Joel Hernandez](https://lifenautjoe.com)

2 changes: 1 addition & 1 deletion code-of-conduct.md
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at alexjovermorales@gmail.com. All
reported by contacting the project team at lifenautjoe@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -60,9 +60,9 @@ <h2>Basic usage</h2>
<pre><code class="typescript">const Noel = require('Noel');
const noel = new Noel();

noel.emit('friday', arg1, arg2 ....);
noel.emit('userChanged', myNewUser);

noel.on('friday', partyAllNightLong).replay();</code></pre>
noel.on('userChanged', updateUserAvatar).replay();</code></pre>
</div>
<br>
<div class="noel-read-more">
Binary file added noel-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "noel",
"version": "1.0.0",
"version": "1.0.3",
"description": "A universal, human-centric, replayable javascript event emitter.",
"keywords": [
"event-emitter",
3 changes: 2 additions & 1 deletion src/event-listener-manager.ts
Original file line number Diff line number Diff line change
@@ -16,9 +16,10 @@ export class NoelEventListenerManager {
this.noel.removeEventListener(this.event, this.listener);
}

replay(bufferSize: number): NoelEventListenerManager {
replay(bufferSize?: number): NoelEventListenerManager {
const event = this.event;
if (!event.getReplayIsEnabled()) throw new NoelEventReplayNotEnabled(event);
if (typeof bufferSize === 'undefined') bufferSize = 1;
const actualBufferSize = event.getReplayBufferSize();
if (bufferSize > actualBufferSize) {
const logger = event.getLogger();
4 changes: 2 additions & 2 deletions website/index.html
Original file line number Diff line number Diff line change
@@ -60,9 +60,9 @@ <h2>Basic usage</h2>
<pre><code class="typescript">const Noel = require('Noel');
const noel = new Noel();

noel.emit('friday', arg1, arg2 ....);
noel.emit('userChanged', myNewUser);

noel.on('friday', partyAllNightLong).replay();</code></pre>
noel.on('userChanged', updateUserAvatar).replay();</code></pre>
</div>
<br>
<div class="noel-read-more">