Skip to main content
Version: 5.x.x

Emitter


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

Description

Defined in emitter/emitter.ts:8

Parameters

NameDetails

socket

Required

Socket<AdapterType>

emitterOptions

Required

EmitterOptionsType<Endpoint, AdapterType>

json

Optional

Partial<Emitter<Payload, Response, Endpoint, AdapterType, MappedData, false, false>>

dataMapper

Optional

(data: Payload) => MappedData

Properties

connections

Description

Defined in emitter/emitter.ts:22

Type

Set<ConnectMethodType<AdapterType, Response>>

data

Description

Defined in emitter/emitter.ts:20

Type

Payload

emitterOptions

Description

Defined in emitter/emitter.ts:26

Type

EmitterOptionsType<Endpoint, AdapterType>

endpoint

Description

Defined in emitter/emitter.ts:17

Type

Endpoint

options

Description

Defined in emitter/emitter.ts:21

Type

ExtractEmitterOptionsType<AdapterType>

params

Description

Defined in emitter/emitter.ts:18

Type

ParamsType

socket

Description

Defined in emitter/emitter.ts:25

Type

Socket<AdapterType>

timeout

Description

Defined in emitter/emitter.ts:19

Type

number

Methods

dataMapper()

Description

Defined in emitter/emitter.ts:28

Return

(data: Payload) => MappedData

emit()

Description

Defined in emitter/emitter.ts:127

Return

ExtractEmitterHasDataType<Emitter> extends false ? (options: [object Object]) => string : (ExtractRouteParams<ExtractEmitterEndpointType<Emitter>> extends NegativeTypes ? (options?: [object Object]) => string : (ExtractEmitterHasParamsType<Emitter> extends false ? (options: [object Object]) => string : (options?: [object Object]) => string))

clone()

Preview

clone<NewPayload, MapperData, Params, Data>(options, mapper)

Description

Defined in emitter/emitter.ts:83

Parameters

NameDetails

options

Optional

Partial<EmitterOptionsType<Endpoint, AdapterType>> & { data?: NewPayload; params?: ParamsType }

mapper

Optional

(data: NewPayload) => MapperData

Return

Emitter<NewPayload, Response, Endpoint, AdapterType, MapperData, Params, Data>

getAck()

Preview

getAck(ack)

Description

Defined in emitter/emitter.ts:112

Parameters

NameDetails

ack

Optional

EmitterAcknowledgeType<any, AdapterType>

Return

(response: [object Object]) => void

onData()

Preview

onData(callback)

Description

Attach global logic to the received events

Defined in emitter/emitter.ts:66

Parameters

NameDetails

callback

Required

ConnectMethodType<AdapterType, Response>

Return

Emitter<Payload, Response, Endpoint, AdapterType, MappedData, HasParams, HasData>

setData()

Preview

setData(data)

Description

Defined in emitter/emitter.ts:47

Parameters

NameDetails

data

Required

Payload

Return

Emitter<MappedData, Response, Endpoint, AdapterType, MappedData, HasParams, true>

setDataMapper()

Preview

setDataMapper<MapperData>(mapper)

Description

Defined in emitter/emitter.ts:54

Parameters

NameDetails

mapper

Required

(data: Payload) => MapperData

Return

Emitter<Payload, Response, Endpoint, AdapterType, MapperData, HasParams, HasData>

setOptions()

Preview

setOptions(options)

Description

Defined in emitter/emitter.ts:39

Parameters

NameDetails

options

Required

ExtractEmitterOptionsType<AdapterType>

Return

Emitter<Payload, Response, Endpoint, AdapterType, MappedData, HasParams, HasData>

setParams()

Preview

setParams(params)

Description

Defined in emitter/emitter.ts:58

Parameters

NameDetails

params

Required

ExtractRouteParams<Endpoint>

Return

Emitter<Payload, Response, Endpoint, AdapterType, MappedData, true, HasData>

setTimeout()

Preview

setTimeout(timeout)

Description

Defined in emitter/emitter.ts:43

Parameters

NameDetails

timeout

Required

number

Return

Emitter<Payload, Response, Endpoint, AdapterType, MappedData, HasParams, HasData>