Skip to main content
Version: 4.x.x

Emitter


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

Description

Defined in emitter/emitter.ts:8

Parameters

NameDetails

socket

Required

Socket<Adapter>

emitterOptions

Required

EmitterOptionsType<ExtractEmitterOptionsType<Adapter>>

json

Optional

Partial<Emitter<Payload, Response, Adapter, MappedData>>

dataMapper

Optional

(data: Payload) => MappedData

Properties

data

Description

Defined in emitter/emitter.ts:11

Type

Payload

emitterOptions

Description

Defined in emitter/emitter.ts:16

Type

EmitterOptionsType<ExtractEmitterOptionsType<Adapter>>

name

Description

Defined in emitter/emitter.ts:9

Type

string

options

Description

Defined in emitter/emitter.ts:12

Type

ExtractEmitterOptionsType<Adapter>

socket

Description

Defined in emitter/emitter.ts:15

Type

Socket<Adapter>

timeout

Description

Defined in emitter/emitter.ts:10

Type

number

Methods

dataMapper()

Description

Defined in emitter/emitter.ts:18

Return

(data: Payload) => MappedData

clone()

Preview

clone<NewPayload, MapperData>(config, mapper)

Description

Defined in emitter/emitter.ts:46

Parameters

NameDetails

config

Optional

Partial<EmitterCloneOptionsType<NewPayload, ExtractEmitterOptionsType<Adapter>>>

mapper

Optional

(data: NewPayload) => MapperData

Return

Emitter<NewPayload, Response, Adapter, MapperData>

emit()

Preview

emit(options, ack)

Description

Defined in emitter/emitter.ts:62

Parameters

NameDetails

options

Optional

Partial<EmitterCloneOptionsType<Payload, ExtractEmitterOptionsType<Adapter>>>

ack

Optional

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

Return

string

setData()

Preview

setData(data)

Description

Defined in emitter/emitter.ts:35

Parameters

NameDetails

data

Required

Payload

Return

Emitter<Payload, Response, Adapter, MappedData>

setDataMapper()

Preview

setDataMapper<MapperData>(mapper)

Description

Defined in emitter/emitter.ts:42

Parameters

NameDetails

mapper

Required

(data: Payload) => MapperData

Return

Emitter<Payload, Response, Adapter, MapperData>

setOptions()

Preview

setOptions(options)

Description

Defined in emitter/emitter.ts:27

Parameters

NameDetails

options

Required

ExtractEmitterOptionsType<Adapter>

Return

Emitter<Payload, Response, Adapter, MappedData>

setTimeout()

Preview

setTimeout(timeout)

Description

Defined in emitter/emitter.ts:31

Parameters

NameDetails

timeout

Required

number

Return

Emitter<Payload, Response, Adapter, MappedData>