Skip to content

Commit

Permalink
Merge pull request #39 from Ayc0/Ayc0/no-listening
Browse files Browse the repository at this point in the history
Drop listening **BREAKING CHANGE**
  • Loading branch information
Ayc0 authored Jul 30, 2023
2 parents 063a6dc + d56466e commit 71b4438
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 17 deletions.
11 changes: 0 additions & 11 deletions packages/manatea/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,6 @@ const waiter = cup.on(console.log);
waiter();
```

At any moment, you can check if a waiter is running by checking its `listening` attribute:

```js
const waiter = cup.on(console.log);

waiter.listening; // true

waiter();
waiter.listening; // false
```

### Derived cup

You can create a cup based on another one, or multiple other ones:
Expand Down
2 changes: 0 additions & 2 deletions packages/manatea/__tests__/manatea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ describe('Manatea', () => {
const cup = orderCup<number>(1);
const fn = jest.fn();
const waiter = cup.on(fn);
expect(waiter.listening).toBe(true);
waiter();
expect(waiter.listening).toBe(false);
await cup(2);
expect(fn).not.toHaveBeenCalled();
});
Expand Down
4 changes: 0 additions & 4 deletions packages/manatea/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type Handler<FlavoredTea extends Tea> = (
) => void;
export interface Waiter {
(): boolean;
listening: boolean;
}

type Order<FlavoredTea extends Tea, UnflavoredTea extends Tea> =
Expand Down Expand Up @@ -101,9 +100,6 @@ export function orderCup<
cup.on = (fn: Handler<FlavoredTea>) => {
handlers.add(fn);
const waiter = () => handlers.delete(fn);
Object.defineProperty(waiter, 'listening', {
get: () => handlers.has(fn),
});
return waiter as Waiter;
};

Expand Down

0 comments on commit 71b4438

Please sign in to comment.