Skip to main content
Version: 2.x.x

Emitter


import { Emitter } from "@hyper-fetch/sockets"

Description

Defined in emitter/emitter.ts:8

Parameters

NameDetails

socket

Required

Socket<ClientType>

emitterOptions

Required

EmitterOptionsType<ExtractEmitterOptionsType<ClientType>>

dump

Optional

Partial<Emitter<RequestDataType, ResponseDataType, ClientType, MappedData>>

dataMapper

Optional

(data: RequestDataType) => MappedData

Properties

data

Description

Defined in emitter/emitter.ts:11

Type

RequestDataType

emitterOptions

Description

Defined in emitter/emitter.ts:16

Type

EmitterOptionsType<ExtractEmitterOptionsType<ClientType>>

name

Description

Defined in emitter/emitter.ts:9

Type

string

options

Description

Defined in emitter/emitter.ts:12

Type

ExtractEmitterOptionsType<ClientType>

socket

Description

Defined in emitter/emitter.ts:15

Type

Socket<ClientType>

timeout

Description

Defined in emitter/emitter.ts:10

Type

number

Methods

dataMapper()

Description

Defined in emitter/emitter.ts:18

Return

(data: RequestDataType) => MappedData

clone()

Preview

clone<NewRequestDataType, MapperData>(config, mapper)

Description

Defined in emitter/emitter.ts:46

Parameters

NameDetails

config

Optional

Partial<EmitterCloneOptionsType<NewRequestDataType, ExtractEmitterOptionsType<ClientType>>>

mapper

Optional

(data: NewRequestDataType) => MapperData

Return

Emitter<NewRequestDataType, ResponseDataType, ClientType, MapperData>

emit()

Preview

emit(options, ack)

Description

Defined in emitter/emitter.ts:67

Parameters

NameDetails

options

Optional

Partial<EmitterCloneOptionsType<RequestDataType, ExtractEmitterOptionsType<ClientType>>>

ack

Optional

(error: Error, response: ResponseDataType) => void

Return

string

setData()

Preview

setData(data)

Description

Defined in emitter/emitter.ts:35

Parameters

NameDetails

data

Required

RequestDataType

Return

any

setDataMapper()

Preview

setDataMapper<MapperData>(mapper)

Description

Defined in emitter/emitter.ts:42

Parameters

NameDetails

mapper

Required

(data: RequestDataType) => MapperData

Return

Emitter<RequestDataType, ResponseDataType, ClientType, MapperData>

setOptions()

Preview

setOptions(options)

Description

Defined in emitter/emitter.ts:27

Parameters

NameDetails

options

Required

ExtractEmitterOptionsType<ClientType>

Return

Emitter<RequestDataType, ResponseDataType, ClientType, MappedData>

setTimeout()

Preview

setTimeout(timeout)

Description

Defined in emitter/emitter.ts:31

Parameters

NameDetails

timeout

Required

number

Return

Emitter<RequestDataType, ResponseDataType, ClientType, MappedData>