6.7.29 • Published 2 years ago

@darkforest_eth/events v6.7.29

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@darkforest_eth/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 @darkforest_eth/events
yarn add @darkforest_eth/events

When using this in a plugin, you might want to load it with skypack

import * as events from 'http://cdn.skypack.dev/@darkforest_eth/events';

Table of contents

Type aliases

Functions

Type aliases

Callback

Ƭ Callback<T>: (data: T) => void

Type parameters

Name
T

Type declaration

▸ (data): void

Parameters
NameType
dataT
Returns

void


Monomitter

Ƭ Monomitter<T>: Object

Type parameters

Name
T

Type declaration

NameType
clear() => void
publish(data: T) => void
subscribe(cb: Callback<T>) => Subscription

Subscription

Ƭ Subscription: Object

Type declaration

NameType
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

NameTypeDefault valueDescription
emitLatestOnSubscribebooleanfalseif this is true, upon subscription immediately emit the most recently set value, if there is one

Returns

Monomitter<T>

6.7.23

2 years ago

6.7.24

2 years ago

6.7.25

2 years ago

6.7.26

2 years ago

6.7.27

2 years ago

6.7.28

2 years ago

6.7.29

2 years ago

6.7.20

2 years ago

6.7.21

2 years ago

6.7.22

2 years ago

6.7.12

2 years ago

6.7.13

2 years ago

6.7.14

2 years ago

6.7.15

2 years ago

6.7.16

2 years ago

6.7.17

2 years ago

6.7.18

2 years ago

6.7.19

2 years ago

6.7.10

2 years ago

6.7.11

2 years ago

6.7.4

2 years ago

6.7.6

2 years ago

6.7.5

2 years ago

6.7.8

2 years ago

6.7.7

2 years ago

6.7.9

2 years ago

6.6.7

2 years ago

6.6.10

2 years ago

6.6.9

2 years ago

6.6.8

2 years ago

6.7.0

2 years ago

6.7.2

2 years ago

6.7.1

2 years ago

6.7.3

2 years ago

6.6.6

3 years ago

6.6.1

3 years ago

6.6.3

3 years ago

6.6.2

3 years ago

6.6.5

3 years ago

6.6.4

3 years ago

6.5.6

3 years ago

6.5.5

3 years ago

6.5.2

3 years ago

6.5.4

3 years ago

6.5.3

3 years ago

6.5.1

3 years ago

6.3.0

3 years ago

6.5.0

3 years ago