7.1.4 • Published 1 year ago
@dfares/events v7.1.4
@dfares/events
This package contains a typed, single pub/sub pattern used in the Dark Forest game. Inspired by https://www.npmjs.com/package/monomitter
Installation
You can install this package using npm or
yarn by running:
npm install --save @dfares/eventsyarn add @dfares/eventsWhen using this in a plugin, you might want to load it with skypack
import * as events from 'http://cdn.skypack.dev/@dfares/events';Table of contents
Type aliases
Functions
Type aliases
Callback
Ƭ Callback<T>: (data: T) => void
Type parameters
| Name |
|---|
T |
Type declaration
▸ (data): void
Parameters
| Name | Type |
|---|---|
data | T |
Returns
void
Monomitter
Ƭ Monomitter<T>: Object
Type parameters
| Name |
|---|
T |
Type declaration
| Name | Type |
|---|---|
clear | () => void |
publish | (data: T) => void |
subscribe | (cb: Callback<T>) => Subscription |
Subscription
Ƭ Subscription: Object
Type declaration
| Name | Type |
|---|---|
unsubscribe | () => void |
Functions
monomitter
▸ monomitter<T>(emitLatestOnSubscribe?): Monomitter<T>
Constructs a new event emitter, whose purpose is to emit values of the given type.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
emitLatestOnSubscribe | boolean | false | if this is true, upon subscription immediately emit the most recently set value, if there is one |
Returns
Monomitter<T>
7.1.4
1 year ago
6.8.14
2 years ago
6.8.13
2 years ago
6.8.12
2 years ago
6.8.11
2 years ago
6.8.10
2 years ago
6.8.9
2 years ago
6.8.8
2 years ago
6.8.7
2 years ago
6.8.6
2 years ago
6.8.5
2 years ago
6.8.4
2 years ago
6.8.3
2 years ago
6.8.2
2 years ago
6.8.1
2 years ago
6.9.4
2 years ago
6.9.3
2 years ago
6.9.2
2 years ago
6.9.1
2 years ago
6.9.0
2 years ago
6.8.0
2 years ago
6.8.0-dev.0
2 years ago